/** * @covers Veles\DataBase\Connections\PdoConnection::getDsn * @depends testSetDsn */ public function testGetDsn() { $expected = 'mysql:dbname=testdb;host=127.0.0.1'; $this->object->setDsn($expected); $result = $this->object->getDsn(); $msg = 'Wrong Connection::getDsn return result!'; $this->assertSame($expected, $result, $msg); }
/** * @covers Veles\DataBase\Connections\DbConnection::getResource */ public function testGetResource() { $this->object->setDriver('\\Veles\\Tests\\DataBase\\Connections\\PDOStub'); $dsn = 'mysql:host=host;dbname=db_name;charset=utf8'; $this->object->setDsn($dsn)->setUserName('user_name')->setPassword('password'); $actual = $this->object->getResource(); $msg = 'DbConnection::getResource() returns wrong result!'; $this->assertInstanceOf('\\PDO', $actual, $msg); $expected = 'some value'; $this->object->setResource($expected); $result = $this->object->getResource(); $msg = 'DbConnection::getResource() return wrong result!'; $this->assertSame($expected, $result, $msg); }