diff options
author | Igor Scheller <igor.scheller@igorshp.de> | 2017-10-31 13:40:13 +0100 |
---|---|---|
committer | Igor Scheller <igor.scheller@igorshp.de> | 2017-10-31 13:40:13 +0100 |
commit | 60fd72cd1a1e4e53b9af87e00a8c27687c6b5385 (patch) | |
tree | bcf250d05a49a848644af44f09fb897467e3ecb0 /tests/Unit/Config/ConfigServiceProviderTest.php | |
parent | fb05a38a963784716c105e7f214615ad13d2f272 (diff) |
Added service providers
Diffstat (limited to 'tests/Unit/Config/ConfigServiceProviderTest.php')
-rw-r--r-- | tests/Unit/Config/ConfigServiceProviderTest.php | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/tests/Unit/Config/ConfigServiceProviderTest.php b/tests/Unit/Config/ConfigServiceProviderTest.php new file mode 100644 index 00000000..26128e79 --- /dev/null +++ b/tests/Unit/Config/ConfigServiceProviderTest.php @@ -0,0 +1,54 @@ +<?php + +namespace Engelsystem\Test\Config; + +use Engelsystem\Application; +use Engelsystem\Config\Config; +use Engelsystem\Config\ConfigServiceProvider; +use PHPUnit\Framework\TestCase; +use PHPUnit_Framework_MockObject_MockObject; + +class ConfigServiceProviderTest extends TestCase +{ + /** + * @covers \Engelsystem\Config\ConfigServiceProvider::register() + */ + public function testRegister() + { + /** @var PHPUnit_Framework_MockObject_MockObject|Config $config */ + $config = $this->getMockBuilder(Config::class) + ->getMock(); + + /** @var PHPUnit_Framework_MockObject_MockObject|Application $app */ + $app = $this->getMockBuilder(Application::class) + ->setMethods(['make', 'instance', 'get']) + ->getMock(); + Application::setInstance($app); + + $app->expects($this->once()) + ->method('make') + ->with(Config::class) + ->willReturn($config); + + $app->expects($this->once()) + ->method('instance') + ->with('config', $config); + + $app->expects($this->atLeastOnce()) + ->method('get') + ->with('path.config') + ->willReturn(__DIR__ . '/../../../config'); + + $config->expects($this->exactly(2)) + ->method('set') + ->withAnyParameters(); + + $config->expects($this->once()) + ->method('get') + ->with(null) + ->willReturn([]); + + $serviceProvider = new ConfigServiceProvider($app); + $serviceProvider->register(); + } +} |