diff --git a/KlarnaCheckoutGatewayFactory.php b/KlarnaCheckoutGatewayFactory.php index 0163ff6..bbfb14d 100644 --- a/KlarnaCheckoutGatewayFactory.php +++ b/KlarnaCheckoutGatewayFactory.php @@ -70,5 +70,9 @@ protected function populateConfig(ArrayObject $config) return $klarnaConfig; }; } + + $config['payum.paths'] = array_replace([ + 'PayumKlarnaCheckout' => __DIR__.'/Resources/views', + ], $config['payum.paths'] ?: []); } } diff --git a/Tests/KlarnaCheckoutGatewayFactoryTest.php b/Tests/KlarnaCheckoutGatewayFactoryTest.php index 50b1b60..dce59fe 100644 --- a/Tests/KlarnaCheckoutGatewayFactoryTest.php +++ b/Tests/KlarnaCheckoutGatewayFactoryTest.php @@ -160,4 +160,28 @@ public function shouldThrowIfRequiredOptionsNotPassed() $factory->create(); } + + /** + * @test + */ + public function shouldConfigurePaths() + { + $factory = new KlarnaCheckoutGatewayFactory(); + + $config = $factory->createConfig(); + + $this->assertInternalType('array', $config); + $this->assertNotEmpty($config); + + $this->assertInternalType('array', $config['payum.paths']); + $this->assertNotEmpty($config['payum.paths']); + + $this->assertArrayHasKey('PayumCore', $config['payum.paths']); + $this->assertStringEndsWith('Resources/views', $config['payum.paths']['PayumCore']); + $this->assertTrue(file_exists($config['payum.paths']['PayumCore'])); + + $this->assertArrayHasKey('PayumKlarnaCheckout', $config['payum.paths']); + $this->assertStringEndsWith('Resources/views', $config['payum.paths']['PayumKlarnaCheckout']); + $this->assertTrue(file_exists($config['payum.paths']['PayumKlarnaCheckout'])); + } }