public function testInvalidCharset() { $this->markTestSkipped(); $db = Propel::getDB(BookPeer::DATABASE_NAME); if ($db instanceof DBSQLite) { $this->markTestSkipped(); } $a = new Author(); $a->setFirstName("Б."); $a->setLastName("АКУНИН"); $a->save(); $authorNameWindows1251 = iconv("utf-8", "windows-1251", $a->getLastName()); $a->setLastName($authorNameWindows1251); // Different databases seem to handle invalid data differently (no surprise, I guess...) if ($db instanceof DBPostgres) { try { $a->save(); $this->fail("Expected an exception when saving non-UTF8 data to database."); } catch (Exception $x) { print $x; } } else { // No exception is thrown by MySQL ... (others need to be tested still) $a->save(); $a->reload(); $this->assertEquals("", $a->getLastName(), "Expected last_name to be empty (after inserting invalid charset data)"); } }
public function test_timestamps_set_before_save() { $author = new Author(); $author->save(); $this->assert_not_null($author->created_at, $author->updated_at); $author->reload(); $this->assert_not_null($author->created_at, $author->updated_at); }
public function testTimestampsSetBeforeSave() { $author = new Author(); $author->save(); $this->assertNotNull($author->created_at, $author->updated_at); $author->reload(); $this->assertNotNull($author->created_at, $author->updated_at); }