Beispiel #1
0
 public function testDoctrineRecordDeleteSetsFlag()
 {
     Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_USE_DQL_CALLBACKS, true);
     $test = new SoftDeleteTest();
     $test->name = 'test';
     $test->something = 'test';
     $test->save();
     $test->delete();
     $this->assertTrue(strtotime($test->deleted_at) > 0);
     $test->free();
     Doctrine_Manager::getInstance()->setAttribute(Doctrine::ATTR_USE_DQL_CALLBACKS, false);
 }
 public function testDoctrineRecordDeleteSetsFlag()
 {
     Doctrine_Manager::getInstance()->setAttribute('use_dql_callbacks', true);
     $test = new SoftDeleteTest();
     $test->name = 'test';
     $test->something = 'test';
     $test->save();
     $test->delete();
     $this->assertTrue(strtotime($test->deleted_at) > 0);
     $test->free();
     Doctrine_Manager::getInstance()->setAttribute('use_dql_callbacks', false);
 }
Beispiel #3
0
 public function testSoftDelete()
 {
     $r = new SoftDeleteTest();
     $r->name = 'something';
     $r->something = 'something';
     $r->save();
     $this->assertEqual($r->name, 'something');
     $this->assertEqual($r->something, 'something');
     $this->assertEqual($r->deleted_at, null);
     $this->assertEqual($r->state(), Doctrine_Record::STATE_CLEAN);
     try {
         $r->delete();
         $this->assertEqual($r->state(), Doctrine_Record::STATE_CLEAN);
         $this->assertTrue(strtotime($r->deleted_at) > 0);
     } catch (Doctrine_Exception $e) {
         $this->fail();
     }
 }