| Total Complexity | 2 |
| Total Lines | 29 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 13 | class DbTest extends TestCase |
||
| 14 | { |
||
| 15 | protected function tearDown(): void |
||
| 16 | { |
||
| 17 | m::close(); |
||
| 18 | } |
||
| 19 | |||
| 20 | public function testMake() |
||
| 21 | { |
||
| 22 | $event = m::mock(Event::class); |
||
| 23 | $config = m::mock(Config::class); |
||
| 24 | $log = m::mock(Log::class); |
||
| 25 | $cache = m::mock(Cache::class); |
||
| 26 | |||
| 27 | $db = Db::__make($event, $config, $log, $cache); |
||
| 28 | |||
| 29 | $config->shouldReceive('get')->with('database.foo', null)->andReturn('foo'); |
||
| 30 | $this->assertEquals('foo', $db->getConfig('foo')); |
||
| 31 | |||
| 32 | $config->shouldReceive('get')->with('database', [])->andReturn([]); |
||
| 33 | $this->assertEquals([], $db->getConfig()); |
||
| 34 | |||
| 35 | $callback = function () { |
||
| 36 | }; |
||
| 37 | $event->shouldReceive('listen')->with('db.some', $callback); |
||
| 38 | $db->event('some', $callback); |
||
| 39 | |||
| 40 | $event->shouldReceive('trigger')->with('db.some', null, false); |
||
| 41 | $db->trigger('some'); |
||
| 42 | } |
||
| 45 |