|
|
@ -5,10 +5,10 @@ namespace Engelsystem\Test\Config;
|
|
|
|
use Engelsystem\Application;
|
|
|
|
use Engelsystem\Application;
|
|
|
|
use Engelsystem\Config\Config;
|
|
|
|
use Engelsystem\Config\Config;
|
|
|
|
use Engelsystem\Config\ConfigServiceProvider;
|
|
|
|
use Engelsystem\Config\ConfigServiceProvider;
|
|
|
|
use PHPUnit\Framework\TestCase;
|
|
|
|
use Engelsystem\Test\Unit\ServiceProviderTest;
|
|
|
|
use PHPUnit_Framework_MockObject_MockObject;
|
|
|
|
use PHPUnit_Framework_MockObject_MockObject;
|
|
|
|
|
|
|
|
|
|
|
|
class ConfigServiceProviderTest extends TestCase
|
|
|
|
class ConfigServiceProviderTest extends ServiceProviderTest
|
|
|
|
{
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @covers \Engelsystem\Config\ConfigServiceProvider::register()
|
|
|
|
* @covers \Engelsystem\Config\ConfigServiceProvider::register()
|
|
|
@ -19,34 +19,15 @@ class ConfigServiceProviderTest extends TestCase
|
|
|
|
$config = $this->getMockBuilder(Config::class)
|
|
|
|
$config = $this->getMockBuilder(Config::class)
|
|
|
|
->getMock();
|
|
|
|
->getMock();
|
|
|
|
|
|
|
|
|
|
|
|
/** @var PHPUnit_Framework_MockObject_MockObject|Application $app */
|
|
|
|
$app = $this->getApp(['make', 'instance', 'get']);
|
|
|
|
$app = $this->getMockBuilder(Application::class)
|
|
|
|
|
|
|
|
->setMethods(['make', 'instance', 'get'])
|
|
|
|
|
|
|
|
->getMock();
|
|
|
|
|
|
|
|
Application::setInstance($app);
|
|
|
|
Application::setInstance($app);
|
|
|
|
|
|
|
|
|
|
|
|
$app->expects($this->once())
|
|
|
|
$this->setExpects($app, 'make', [Config::class], $config);
|
|
|
|
->method('make')
|
|
|
|
$this->setExpects($app, 'instance', ['config', $config]);
|
|
|
|
->with(Config::class)
|
|
|
|
$this->setExpects($app, 'get', ['path.config'], __DIR__ . '/../../../config', $this->atLeastOnce());
|
|
|
|
->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())
|
|
|
|
$this->setExpects($config, 'set', null, null, $this->exactly(2));
|
|
|
|
->method('get')
|
|
|
|
$this->setExpects($config, 'get', [null], []);
|
|
|
|
->with(null)
|
|
|
|
|
|
|
|
->willReturn([]);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$serviceProvider = new ConfigServiceProvider($app);
|
|
|
|
$serviceProvider = new ConfigServiceProvider($app);
|
|
|
|
$serviceProvider->register();
|
|
|
|
$serviceProvider->register();
|
|
|
|