/** * @test * @covers SlimApp\Db\DbTable::setConnection * @covers SlimApp\Db\DbTable::getConnection * @uses SlimApp\HasRequiredParamsTrait */ public function setConnection_sets_dbAdapter_and_returns_DbTable_instance_if_config_set_and_correct() { $config = (require __DIR__ . '/database-config-for-dbunit.php'); $table = $this->getMockBuilder('SlimApp\\Db\\DbTable')->setConstructorArgs([$config])->getMockForAbstractClass(); $dbTable = new \SebastianBergmann\PeekAndPoke\Proxy($table); $table = $dbTable->setConnection(); $dbAdapter = $dbTable->getConnection(); $this->assertInstanceOf('\\SlimApp\\Db\\DbTable', $table); $this->assertInstanceOf('\\PDO', $dbAdapter); }