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.
engelsystem/tests/Unit/Database/DatabaseServiceProviderTest...

38 lines
1.1 KiB
PHTML

<?php
namespace Engelsystem\Test\Unit\Database;
use Engelsystem\Config\Config;
use Engelsystem\Database\DatabaseServiceProvider;
use Engelsystem\Test\Unit\ServiceProviderTest;
use Exception;
use PHPUnit_Framework_MockObject_MockObject;
class DatabaseServiceProviderTest extends ServiceProviderTest
{
/**
* @covers \Engelsystem\Database\DatabaseServiceProvider::register()
* @covers \Engelsystem\Database\DatabaseServiceProvider::exitOnError()
*/
public function testRegister()
{
/** @var PHPUnit_Framework_MockObject_MockObject|Config $config */
$config = $this->getMockBuilder(Config::class)
->getMock();
$app = $this->getApp(['get']);
$this->setExpects($app, 'get', ['config'], $config);
$this->setExpects($config, 'get', ['database'], [
'host' => 'localhost',
'db' => 'database',
'user' => 'user',
'pw' => 'password',
], $this->atLeastOnce());
$this->expectException(Exception::class);
$serviceProvider = new DatabaseServiceProvider($app);
$serviceProvider->register();
}
}