1
0
Fork 0
mirror of synced 2025-04-03 05:13:37 +03:00
This commit is contained in:
zYne 2007-06-07 20:46:26 +00:00
parent f2895955e8
commit be34a396d7

View file

@ -38,22 +38,29 @@ class Doctrine_AuditLog_TestCase extends Doctrine_UnitTestCase
{ } { }
public function testVersionTableSqlReturnsProperQuery() public function testVersionTableSqlReturnsProperQuery()
{ {
$table = $this->conn->getTable('Entity'); $table = $this->conn->getTable('Versionable');
$auditLog = $table->getAuditLog();
$auditLog = new Doctrine_AuditLog($table);
$auditLog->audit(); $auditLog->audit();
$entity = new Entity(); $entity = new Versionable();
$entity->name = 'zYne'; $entity->name = 'zYne';
$entity->password = 'secret';
$entity->save(); $entity->save();
$this->assertEqual($entity->version, 1);
$entity->name = 'zYne 2'; $entity->name = 'zYne 2';
$entity->save(); $entity->save();
$entity->EntityVersion;
$this->assertEqual($entity->version, 2);
$entity->delete();
$this->assertEqual($entity->version, 3);
$entity->revert(2);
$this->assertEqual($entity->name, 'zYne 2');
} }
public function testUpdateTriggerSqlReturnsProperQuery() public function testUpdateTriggerSqlReturnsProperQuery()
{ {
@ -73,7 +80,7 @@ class Doctrine_AuditLog_TestCase extends Doctrine_UnitTestCase
$sql = $auditLog->deleteTriggerSql($table); $sql = $auditLog->deleteTriggerSql($table);
$this->assertEqual($sql, 'CREATE TRIGGER entity_ddt DELETE ON entity BEGIN INSERT INTO entity_dvt (id, name, loginname, password, type, created, updated, email_id) VALUES (old.id, old.name, old.loginname, old.password, old.type, old.created, old.updated, old.email_id); END;'); $this->assertEqual($sql, 'CREATE TRIGGER entity_ddt BEFORE DELETE ON entity BEGIN INSERT INTO entity_dvt (id, name, loginname, password, type, created, updated, email_id) VALUES (old.id, old.name, old.loginname, old.password, old.type, old.created, old.updated, old.email_id); END;');
} }
} }
class Versionable extends Doctrine_Record class Versionable extends Doctrine_Record