engelsystem/tests/Feature/Database/DatabaseServiceProviderTest...

41 lines
1.1 KiB
PHP
Raw Normal View History

2017-10-31 13:40:13 +01:00
<?php
namespace Engelsystem\Test\Feature\Database;
2017-10-31 13:40:13 +01:00
use Engelsystem\Application;
use Engelsystem\Config\Config;
use Engelsystem\Database\DatabaseServiceProvider;
2017-10-31 19:26:48 +01:00
use PHPUnit_Framework_MockObject_MockObject as MockObject;
2017-10-31 13:40:13 +01:00
2017-10-31 19:26:48 +01:00
class DatabaseServiceProviderTest extends DatabaseTest
2017-10-31 13:40:13 +01:00
{
/**
* @covers \Engelsystem\Database\DatabaseServiceProvider::register()
*/
public function testRegister()
{
2017-10-31 19:26:48 +01:00
/** @var MockObject|Config $config */
2017-10-31 13:40:13 +01:00
$config = $this->getMockBuilder(Config::class)
->getMock();
2017-10-31 19:26:48 +01:00
/** @var MockObject|Application $app */
2017-10-31 13:40:13 +01:00
$app = $this->getMockBuilder(Application::class)
->setMethods(['get'])
->getMock();
Application::setInstance($app);
$app->expects($this->once())
->method('get')
->with('config')
->willReturn($config);
$config->expects($this->atLeastOnce())
->method('get')
->with('database')
->willReturn($this->getDbConfig());
$serviceProvider = new DatabaseServiceProvider($app);
$serviceProvider->register();
}
}