summaryrefslogtreecommitdiff
path: root/tests/Unit/Database
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Unit/Database')
-rw-r--r--tests/Unit/Database/DatabaseServiceProviderTest.php34
1 files changed, 11 insertions, 23 deletions
diff --git a/tests/Unit/Database/DatabaseServiceProviderTest.php b/tests/Unit/Database/DatabaseServiceProviderTest.php
index d0e3e164..d61f5ae7 100644
--- a/tests/Unit/Database/DatabaseServiceProviderTest.php
+++ b/tests/Unit/Database/DatabaseServiceProviderTest.php
@@ -2,14 +2,13 @@
namespace Engelsystem\Test\Database;
-use Engelsystem\Application;
use Engelsystem\Config\Config;
use Engelsystem\Database\DatabaseServiceProvider;
+use Engelsystem\Test\Unit\ServiceProviderTest;
use Exception;
-use PHPUnit\Framework\TestCase;
use PHPUnit_Framework_MockObject_MockObject;
-class DatabaseServiceProviderTest extends TestCase
+class DatabaseServiceProviderTest extends ServiceProviderTest
{
/**
* @covers \Engelsystem\Database\DatabaseServiceProvider::register()
@@ -21,29 +20,18 @@ class DatabaseServiceProviderTest extends TestCase
$config = $this->getMockBuilder(Config::class)
->getMock();
- /** @var PHPUnit_Framework_MockObject_MockObject|Application $app */
- $app = $this->getMockBuilder(Application::class)
- ->setMethods(['get'])
- ->getMock();
-
- $app->expects($this->once())
- ->method('get')
- ->with('config')
- ->willReturn($config);
-
- $config->expects($this->atLeastOnce())
- ->method('get')
- ->with('database')
- ->willReturn([
- 'host' => 'localhost',
- 'db' => 'database',
- 'user' => 'user',
- 'pw' => 'password',
- ]);
+ $app = $this->getApp(['get']);
- $serviceProvider = new DatabaseServiceProvider($app);
+ $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();
}
}