コード例 #1
0
 public function testQuerySelect()
 {
     $t = new Table4();
     $t->setDeletedAt(123);
     $t->save();
     Table4Peer::enableSoftDelete();
     $this->assertEquals(0, Table4Query::create()->count(), 'rows with a deleted_at date are hidden for select queries');
     Table4Peer::disableSoftDelete();
     $this->assertEquals(1, Table4Query::create()->count(), 'rows with a deleted_at date are visible for select queries once the static soft_delete is enabled');
     $this->assertTrue(Table4Peer::isSoftDeleteEnabled(), 'Executing a select query enables the static soft delete again');
 }
コード例 #2
0
 public function testForceDelete()
 {
     $t = new Table4();
     $t->save();
     $t->forceDelete();
     $this->assertTrue($t->isDeleted(), 'forceDelete() actually deletes a row');
     Table4Peer::disableSoftDelete();
     $this->assertEquals(0, Table4Peer::doCount(new Criteria()), 'forced deleted rows are not present in the database');
 }