Commit be34a396 authored by zYne's avatar zYne

--no commit message

--no commit message
parent f2895955
......@@ -38,22 +38,29 @@ class Doctrine_AuditLog_TestCase extends Doctrine_UnitTestCase
{ }
public function testVersionTableSqlReturnsProperQuery()
{
$table = $this->conn->getTable('Entity');
$table = $this->conn->getTable('Versionable');
$auditLog = $table->getAuditLog();
$auditLog = new Doctrine_AuditLog($table);
$auditLog->audit();
$entity = new Entity();
$entity = new Versionable();
$entity->name = 'zYne';
$entity->password = 'secret';
$entity->save();
$this->assertEqual($entity->version, 1);
$entity->name = 'zYne 2';
$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()
{
......@@ -73,7 +80,7 @@ class Doctrine_AuditLog_TestCase extends Doctrine_UnitTestCase
$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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment