You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.1 KiB
PHTML
41 lines
1.1 KiB
PHTML
7 years ago
|
<?php
|
||
|
|
||
7 years ago
|
namespace Engelsystem\Test\Feature\Database;
|
||
7 years ago
|
|
||
|
use Engelsystem\Application;
|
||
|
use Engelsystem\Config\Config;
|
||
|
use Engelsystem\Database\DatabaseServiceProvider;
|
||
7 years ago
|
use PHPUnit_Framework_MockObject_MockObject as MockObject;
|
||
7 years ago
|
|
||
7 years ago
|
class DatabaseServiceProviderTest extends DatabaseTest
|
||
7 years ago
|
{
|
||
|
/**
|
||
|
* @covers \Engelsystem\Database\DatabaseServiceProvider::register()
|
||
|
*/
|
||
|
public function testRegister()
|
||
|
{
|
||
7 years ago
|
/** @var MockObject|Config $config */
|
||
7 years ago
|
$config = $this->getMockBuilder(Config::class)
|
||
|
->getMock();
|
||
|
|
||
7 years ago
|
/** @var MockObject|Application $app */
|
||
7 years ago
|
$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();
|
||
|
}
|
||
|
}
|