Commit b99a3d7a authored by Steve Müller's avatar Steve Müller

use platform specific datetime format for assertions

parent e4d1084b
......@@ -188,15 +188,17 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
*/
public function testInsertWithKeyValueTypes()
{
$testString = new \DateTime('2013-04-14 10:10:10');
$this->_conn->insert(
'write_table',
array('test_int' => '30', 'test_string' => new \DateTime('2013-04-14 10:10:10')),
array('test_int' => '30', 'test_string' => $testString),
array('test_string' => 'datetime', 'test_int' => 'integer')
);
$data = $this->_conn->fetchColumn('SELECT test_string FROM write_table WHERE test_int = 30');
$this->assertEquals('2013-04-14 10:10:10', $data);
$this->assertEquals($testString->format($this->_conn->getDatabasePlatform()->getDateTimeFormatString()), $data);
}
/**
......@@ -204,22 +206,26 @@ class WriteTest extends \Doctrine\Tests\DbalFunctionalTestCase
*/
public function testUpdateWithKeyValueTypes()
{
$testString = new \DateTime('2013-04-14 10:10:10');
$this->_conn->insert(
'write_table',
array('test_int' => '30', 'test_string' => new \DateTime('2013-04-14 10:10:10')),
array('test_int' => '30', 'test_string' => $testString),
array('test_string' => 'datetime', 'test_int' => 'integer')
);
$testString = new \DateTime('2013-04-15 10:10:10');
$this->_conn->update(
'write_table',
array('test_string' => new \DateTime('2013-04-15 10:10:10')),
array('test_string' => $testString),
array('test_int' => '30'),
array('test_string' => 'datetime', 'test_int' => 'integer')
);
$data = $this->_conn->fetchColumn('SELECT test_string FROM write_table WHERE test_int = 30');
$this->assertEquals('2013-04-15 10:10:10', $data);
$this->assertEquals($testString->format($this->_conn->getDatabasePlatform()->getDateTimeFormatString()), $data);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment