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
13941a6b
Commit
13941a6b
authored
Sep 01, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
07c5c92e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
8 deletions
+25
-8
SnapshotTestCase.php
tests/Collection/SnapshotTestCase.php
+17
-2
HookTestCase.php
tests/Record/HookTestCase.php
+8
-6
No files found.
tests/Collection/SnapshotTestCase.php
View file @
13941a6b
...
...
@@ -40,7 +40,7 @@ class Doctrine_Collection_Snapshot_TestCase extends Doctrine_UnitTestCase
{
public
function
prepareTables
()
{
$this
->
tables
=
array
(
'Entity'
,
'User'
,
'Group'
,
'Phonenumber'
,
'Email'
,
'Book'
);
$this
->
tables
=
array
(
'Entity'
,
'User'
,
'Group'
,
'
GroupUser'
,
'Account'
,
'Album'
,
'
Phonenumber'
,
'Email'
,
'Book'
);
parent
::
prepareTables
();
}
...
...
@@ -58,8 +58,13 @@ class Doctrine_Collection_Snapshot_TestCase extends Doctrine_UnitTestCase
$coll
[]
->
name
=
'new user'
;
$this
->
assertEqual
(
$coll
->
count
(),
7
);
$this
->
assertEqual
(
count
(
$coll
->
getSnapshot
()),
8
);
$count
=
$this
->
conn
->
count
();
$coll
->
save
();
print
$this
->
conn
->
count
();
print
$count
;
$this
->
connection
->
clear
();
$coll
=
Doctrine_Query
::
create
()
->
from
(
'User u'
)
->
execute
();
...
...
@@ -113,17 +118,27 @@ class Doctrine_Collection_Snapshot_TestCase extends Doctrine_UnitTestCase
$this
->
assertEqual
(
$users
[
0
]
->
Group
[
0
]
->
name
,
'PHP'
);
$this
->
assertEqual
(
$users
[
0
]
->
Group
[
1
]
->
name
,
'Web'
);
$this
->
assertEqual
(
count
(
$user
->
Group
->
getSnapshot
()),
2
);
unset
(
$user
->
Group
[
0
]);
$user
->
save
();
$this
->
assertEqual
(
count
(
$user
->
Group
),
1
);
$this
->
assertEqual
(
count
(
$user
->
Group
->
getSnapshot
()),
1
);
unset
(
$user
->
Group
[
1
]);
$this
->
assertEqual
(
count
(
$user
->
Group
->
getSnapshot
()),
1
);
$count
=
count
(
$this
->
conn
);
$user
->
save
();
$this
->
assertEqual
(
count
(
$user
->
Group
->
getSnapshot
()),
0
);
$this
->
conn
->
clear
();
$users
=
Doctrine_Query
::
create
()
->
from
(
'User u LEFT JOIN u.Group g'
)
->
where
(
'u.id = '
.
$user
->
id
)
->
execute
();
$this
->
assertEqual
(
count
(
$user
->
Group
),
0
);
}
...
...
tests/Record/HookTestCase.php
View file @
13941a6b
...
...
@@ -37,10 +37,10 @@ class Doctrine_Record_Hook_TestCase extends Doctrine_UnitTestCase
public
function
prepareTables
()
{
$this
->
tables
=
array
(
'RecordHookTest'
,
'SoftDeleteTest'
);
parent
::
prepareTables
();
}
/**
public function testInsertHooksGetInvoked()
{
$r = new RecordHookTest();
...
...
@@ -67,7 +67,7 @@ class Doctrine_Record_Hook_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($r->pop(), 'preUpdate');
$this->assertEqual($r->pop(), 'preSave');
}
public function testDeleteHooksGetInvoked()
{
$records = Doctrine_Query::create()->from('RecordHookTest t')->where("t.name = 'record 2'")->execute();
...
...
@@ -78,7 +78,7 @@ class Doctrine_Record_Hook_TestCase extends Doctrine_UnitTestCase
$this->assertEqual($r->pop(), 'postDelete');
$this->assertEqual($r->pop(), 'preDelete');
}
*/
public
function
testSoftDelete
()
{
$r
=
new
SoftDeleteTest
();
...
...
@@ -92,14 +92,15 @@ class Doctrine_Record_Hook_TestCase extends Doctrine_UnitTestCase
$this
->
assertEqual
(
$r
->
deleted
,
null
);
$this
->
assertEqual
(
$r
->
state
(),
Doctrine_Record
::
STATE_CLEAN
);
try
{
try
{
$r
->
delete
();
$this
->
assertEqual
(
$r
->
state
(),
Doctrine_Record
::
STATE_CLEAN
);
$this
->
assertEqual
(
$r
->
deleted
,
true
);
}
catch
(
Doctrine_Exception
$e
)
{
}
catch
(
Doctrine_Exception
$e
)
{
$this
->
fail
();
}
}
}
class
SoftDeleteTest
extends
Doctrine_Record
{
...
...
@@ -116,6 +117,7 @@ class SoftDeleteTest extends Doctrine_Record
public
function
postDelete
(
$event
)
{
$this
->
deleted
=
true
;
$this
->
save
();
}
}
...
...
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