コード例 #1
0
 public function testEnumField()
 {
     $o = new \VersionableBehaviorTest7();
     $o->setStyle('novel');
     $o->save();
     $this->assertEquals('novel', $o->getStyle(), 'Set style to novel');
     $this->assertEquals(1, $o->getVersion(), '');
     $o->setStyle('essay');
     $o->save();
     $this->assertEquals('essay', $o->getStyle(), 'Set style to essay');
     $this->assertEquals(2, $o->getVersion(), '');
     $this->assertEquals('novel', $o->getOneVersion(1)->getStyle(), 'First version is a novel');
     $this->assertEquals('essay', $o->getOneVersion(2)->getStyle(), 'Second version is an essay');
 }
コード例 #2
0
 public function testSaveAndModifyWithNoChangeSchema()
 {
     $o = new VersionableBehaviorTest7();
     //$o->setVersionCreatedBy('You and I');
     $o->save();
     $this->assertEquals(1, $o->getVersion());
     $o->setFooBar('Something');
     $o->save();
     $this->assertEquals(2, $o->getVersion());
     $o = new VersionableBehaviorTest6();
     //$o->setVersionCreatedBy('You and I');
     $o->save();
     $this->assertEquals(1, $o->getVersion());
     $o->setFooBar('Something');
     $o->save();
     $this->assertEquals(2, $o->getVersion());
 }