summaryrefslogtreecommitdiff
path: root/tests/Unit/Config/ConfigServiceProviderTest.php
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2017-10-31 14:15:19 +0100
committerIgor Scheller <igor.scheller@igorshp.de>2017-10-31 14:15:19 +0100
commit411ea5bb6d0ecf32e6c989a99fac120502db9fe9 (patch)
tree736b66c00b26dac8fc9cf4283d4888b0b69b9816 /tests/Unit/Config/ConfigServiceProviderTest.php
parent915cbee3e099cc7d48f71f6627b5fde3942cbe88 (diff)
Refactored service provider tests
Diffstat (limited to 'tests/Unit/Config/ConfigServiceProviderTest.php')
-rw-r--r--tests/Unit/Config/ConfigServiceProviderTest.php35
1 files changed, 8 insertions, 27 deletions
diff --git a/tests/Unit/Config/ConfigServiceProviderTest.php b/tests/Unit/Config/ConfigServiceProviderTest.php
index 26128e79..96ac8704 100644
--- a/tests/Unit/Config/ConfigServiceProviderTest.php
+++ b/tests/Unit/Config/ConfigServiceProviderTest.php
@@ -5,10 +5,10 @@ namespace Engelsystem\Test\Config;
use Engelsystem\Application;
use Engelsystem\Config\Config;
use Engelsystem\Config\ConfigServiceProvider;
-use PHPUnit\Framework\TestCase;
+use Engelsystem\Test\Unit\ServiceProviderTest;
use PHPUnit_Framework_MockObject_MockObject;
-class ConfigServiceProviderTest extends TestCase
+class ConfigServiceProviderTest extends ServiceProviderTest
{
/**
* @covers \Engelsystem\Config\ConfigServiceProvider::register()
@@ -19,34 +19,15 @@ class ConfigServiceProviderTest extends TestCase
$config = $this->getMockBuilder(Config::class)
->getMock();
- /** @var PHPUnit_Framework_MockObject_MockObject|Application $app */
- $app = $this->getMockBuilder(Application::class)
- ->setMethods(['make', 'instance', 'get'])
- ->getMock();
+ $app = $this->getApp(['make', 'instance', 'get']);
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();
+ $this->setExpects($app, 'make', [Config::class], $config);
+ $this->setExpects($app, 'instance', ['config', $config]);
+ $this->setExpects($app, 'get', ['path.config'], __DIR__ . '/../../../config', $this->atLeastOnce());
- $config->expects($this->once())
- ->method('get')
- ->with(null)
- ->willReturn([]);
+ $this->setExpects($config, 'set', null, null, $this->exactly(2));
+ $this->setExpects($config, 'get', [null], []);
$serviceProvider = new ConfigServiceProvider($app);
$serviceProvider->register();