Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
943a7c8b
Commit
943a7c8b
authored
Jul 18, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
941a2e57
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
29 deletions
+21
-29
AuditLogTestCase.php
tests/AuditLogTestCase.php
+21
-29
No files found.
tests/AuditLogTestCase.php
View file @
943a7c8b
...
...
@@ -32,23 +32,23 @@
*/
class
Doctrine_AuditLog_TestCase
extends
Doctrine_UnitTestCase
{
public
function
prepareData
()
public
function
prepareData
()
{
}
public
function
prepareTables
()
{
$this
->
tables
=
array
(
'Versionable'
);
$this
->
profiler
=
new
Doctrine_Connection_Profiler
();
$this
->
conn
->
addListener
(
$this
->
profiler
);
$this
->
tables
=
array
(
'VersioningTest'
,
'VersioningTestVersion'
);
parent
::
prepareTables
();
}
public
function
testVersionTableSqlReturnsProperQuery
()
{
$table
=
$this
->
conn
->
getTable
(
'Versionable'
);
$auditLog
=
$table
->
getAuditLog
();
$auditLog
->
audit
();
public
function
testVersioningListenerListensAllManipulationOperations
()
{
$entity
=
new
VersioningTest
();
$entity
=
new
Versionable
();
$entity
->
name
=
'zYne'
;
$entity
->
save
();
$this
->
assertEqual
(
$entity
->
version
,
1
);
...
...
@@ -58,36 +58,28 @@ class Doctrine_AuditLog_TestCase extends Doctrine_UnitTestCase
$this
->
assertEqual
(
$entity
->
version
,
2
);
$entity
->
delete
();
$this
->
assertEqual
(
$entity
->
version
,
3
);
$entity
->
revert
(
2
);
$this
->
assertEqual
(
$entity
->
name
,
'zYne 2'
);
$this
->
assertEqual
(
$entity
->
version
,
2
);
}
public
function
testUpdateTriggerSqlReturnsProperQuery
()
{
$table
=
$this
->
conn
->
getTable
(
'User'
);
$auditLog
=
new
Doctrine_AuditLog
(
$table
);
$sql
=
$auditLog
->
updateTriggerSql
(
$table
);
$this
->
assertEqual
(
$sql
,
'CREATE TRIGGER entity_dut UPDATE 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;'
);
}
public
function
testDeleteTriggerSqlReturnsProperQuery
()
public
function
testRevertThrowsExceptionForTransientRecords
()
{
$
table
=
$this
->
conn
->
getTable
(
'User'
);
$
entity
=
new
VersioningTest
(
);
$auditLog
=
new
Doctrine_AuditLog
(
$table
);
$sql
=
$auditLog
->
deleteTriggerSql
(
$table
);
$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;'
);
try
{
$entity
->
revert
(
1
);
$this
->
fail
();
}
catch
(
Doctrine_Record_Exception
$e
)
{
$this
->
pass
();
}
}
}
class
Version
able
extends
Doctrine_Record
class
Version
ingTest
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
...
...
@@ -96,6 +88,6 @@ class Versionable extends Doctrine_Record
}
public
function
setUp
()
{
$this
->
actAs
(
'Versionable'
);
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment