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
f9ee88a5
Commit
f9ee88a5
authored
Jan 22, 2008
by
pookey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moving ticket to all branches
parent
7255e4fd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
90 additions
and
0 deletions
+90
-0
741TestCase.php
tests/Ticket/741TestCase.php
+90
-0
No files found.
tests/Ticket/741TestCase.php
0 → 100644
View file @
f9ee88a5
<?php
class
Doctrine_Ticket_741_TestCase
extends
Doctrine_UnitTestCase
{
public
function
prepareData
()
{
}
public
function
prepareTables
()
{
$this
->
tables
=
array
(
'Parent741'
,
'Child741'
);
parent
::
prepareTables
();
}
public
function
testTicket
()
{
$moo
=
new
Parent741
();
$moo
->
amount
=
1000
;
$cow
=
new
Child741
();
$moo
->
Cows
[]
=
$cow
;
$cow
->
Moo
=
$moo
;
$moo
->
save
();
$this
->
assertEqual
(
$moo
->
amount
,
0
);
}
}
class
Parent741
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'id'
,
'integer'
,
4
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
,
'notnull'
=>
true
,
));
$this
->
hasColumn
(
'amount'
,
'integer'
);
}
public
function
setUp
()
{
$this
->
hasMany
(
'Child741 as Cows'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'moo_id'
));
}
}
class
Child741
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'id'
,
'integer'
,
4
,
array
(
'primary'
=>
true
,
'autoincrement'
=>
true
,
'notnull'
=>
true
,
));
$this
->
hasColumn
(
'moo_id'
,
'integer'
);
}
public
function
setUp
()
{
$this
->
hasOne
(
'Parent741 as Moo'
,
array
(
'local'
=>
'moo_id'
,
'foreign'
=>
'id'
));
}
public
function
postInsert
(
$e
)
{
//echo "State: ". $this->Moo->state() . " \t Amount: " . $this->Moo->amount . "\n";
$this
->
Moo
->
amount
=
0
;
//echo "State: ". $this->Moo->state() . " \t Amount: " . $this->Moo->amount . "\n";
$this
->
Moo
->
save
();
//echo "State: ". $this->Moo->state() . " \t Amount: " . $this->Moo->amount . "\n";
$this
->
Moo
->
refresh
();
//echo "State: ". $this->Moo->state() . " \t Amount: " . $this->Moo->amount . "\n";
/*
This outputs the following
State: 6 Amount: 1000
State: 6 Amount: 0
State: 6 Amount: 0
State: 3 Amount: 1000
*/
}
}
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