Skip to content

Commit

Permalink
Add tests for toArray() date formats
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Ruoss committed Jul 2, 2020
1 parent 1f0eb22 commit fe5e204
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion tests/Propel/Tests/Generator/Builder/Om/GeneratedObjectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

use Propel\Generator\Config\QuickGeneratorConfig;
use Propel\Runtime\Adapter\Pdo\SqliteAdapter;
use Propel\Tests\Bookstore\BookClubList;
use Propel\Tests\Bookstore\BookstoreQuery;
use Propel\Generator\Util\QuickBuilder;
use Propel\Runtime\Propel;
Expand Down Expand Up @@ -746,7 +747,15 @@ public function testToArrayDateTimeAsString()
$review = new Review();
$review->setReviewDate($date);

$this->assertEquals('2015-01-04T16:00:02+00:00', $review->toArray()['ReviewDate'], 'toArray() format temporal colums as ISO8601');
$bookstore = new Bookstore();
$bookstore->setStoreOpenTime($date);

$bookClubList = new BookClubList();
$bookClubList->setCreatedAt($date);

$this->assertEquals('2015-01-04', $review->toArray()['ReviewDate'], 'toArray() format colums of type DATE as Y-m-d');
$this->assertEquals('16:00:02.000000', $bookstore->toArray()['StoreOpenTime'], 'toArray() format toArray() colums of type TIME as H:i:s.u');
$this->assertEquals('2015-01-04 16:00:02.000000', $bookClubList->toArray()['CreatedAt'], 'toArray() format toArray() colums of type TIMESTAMP as Y-m-d H:i:s.u');
}

public function testWithColumn()
Expand Down

0 comments on commit fe5e204

Please sign in to comment.