Ejemplo n.º 1
0
$serialized = serialize($before);
$after = unserialize($serialized);
$t->is($after->title, 'test', '->unserialize() maintains field values on I18n records');
$conn = Doctrine_Manager::getInstance()->getConnectionForComponent('Article');
$before = new Article();
$before->title = 'test';
$serialized = serialize($before);
$conn->clear();
$conn->evictTables();
$after = unserialize($serialized);
$t->is($after->title, 'test', '->unserialize() maintains field values on I18n records upon reset');
$article = new Article();
try {
    $article->setAuthor(new stdClass());
} catch (Exception $e) {
    $t->is($e->getMessage(), 'Couldn\'t call Doctrine_Core::set(), second argument should be an instance of Doctrine_Record or Doctrine_Null when setting one-to-one references.', 'Making sure proper exception message is thrown');
}
$article = new Article();
$article->title = 'testing this out';
$serialized = serialize($article);
$article = unserialize($serialized);
$t->is($article->getTitle(), 'testing this out', 'Making sure getTitle() is still accessible after unserializing');
try {
    $test = new ModelWithNumberInColumn();
    $test->getColumn1();
    $test->getColumn2();
    $test->getColumn_3();
    $t->pass('Make sure __call() handles fields with *_(n) in the field name');
} catch (Exception $e) {
    $t->fail('__call() failed in sfDoctrineRecord');
}