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
c9268d28
Commit
c9268d28
authored
Aug 03, 2007
by
zYne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
02a93ccb
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
47 additions
and
2 deletions
+47
-2
OneToManyTestCase.php
tests/Relation/OneToManyTestCase.php
+47
-2
No files found.
tests/Relation/OneToManyTestCase.php
View file @
c9268d28
...
...
@@ -36,7 +36,7 @@ class Doctrine_Relation_OneToMany_TestCase extends Doctrine_UnitTestCase
{
}
public
function
prepareTables
()
{
$this
->
tables
=
array
(
'Entity'
,
'Phonenumber'
,
'Email'
,
'Policy'
,
'PolicyAsset'
);
$this
->
tables
=
array
(
'Entity'
,
'Phonenumber'
,
'Email'
,
'Policy'
,
'PolicyAsset'
,
'Role'
,
'Auth'
);
parent
::
prepareTables
();
}
...
...
@@ -94,8 +94,53 @@ class Doctrine_Relation_OneToMany_TestCase extends Doctrine_UnitTestCase
$nr
->
save
();
$nr
->
Entity
=
$e
;
}
public
function
testRelationSaving3
()
{
// create roles and user with role1 and role2
$this
->
conn
->
beginTransaction
();
$role
=
new
Role
();
$role
->
name
=
'role1'
;
$role
->
save
();
$auth
=
new
Auth
();
$auth
->
name
=
'auth1'
;
$auth
->
Role
=
$role
;
$auth
->
save
();
$this
->
conn
->
commit
();
$this
->
conn
->
clear
();
$auths
=
$this
->
conn
->
query
(
'FROM Auth a LEFT JOIN a.Role r'
);
$this
->
assertEqual
(
$auths
[
0
]
->
Role
->
name
,
'role1'
);
}
}
class
Role
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'name'
,
'string'
,
20
,
array
(
'unique'
=>
true
));
}
public
function
setUp
()
{
$this
->
hasMany
(
'Auth'
,
array
(
'local'
=>
'id'
,
'foreign'
=>
'roleid'
));
}
}
class
Auth
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
$this
->
hasColumn
(
'roleid'
,
'integer'
,
10
);
$this
->
hasColumn
(
'name'
,
'string'
,
50
);
}
public
function
setUp
()
{
$this
->
hasOne
(
'Role'
,
array
(
'local'
=>
'roleid'
,
'foreign'
=>
'id'
));
}
}
class
Policy
extends
Doctrine_Record
class
Policy
extends
Doctrine_Record
{
public
function
setTableDefinition
()
{
...
...
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