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;
use PHPUnit\Framework\MockObject\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()
{
/** @var Config|MockObject $config */
2017-10-31 13:40:13 +01:00
$config = $this->getMockBuilder(Config::class)
->getMock();
/** @var Application|MockObject $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();
}
}