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
9ad3a0fc
Commit
9ad3a0fc
authored
Jul 14, 2007
by
njero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test is working now, trying to make it fail...
parent
ab1a8848
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
27 deletions
+27
-27
TicketNjeroTestCase.php
tests/TicketNjeroTestCase.php
+27
-27
No files found.
tests/TicketNjeroTestCase.php
View file @
9ad3a0fc
...
...
@@ -12,7 +12,7 @@
* @version $Revision$
*/
class
CoverageCode
extends
Doctrine_Record
{
class
CoverageCode
N
extends
Doctrine_Record
{
public
function
setTableDefinition
(){
$this
->
setTableName
(
'coverage_codes'
);
...
...
@@ -22,11 +22,11 @@ class CoverageCode extends Doctrine_Record {
}
public
function
setUp
(){
$this
->
index
(
'code'
,
array
(
'fields'
=>
'code'
));
#
$this->index('code', array('fields' => 'code'));
}
}
class
PolicyCode
extends
Doctrine_Record
{
class
PolicyCode
N
extends
Doctrine_Record
{
public
function
setTableDefinition
(){
$this
->
setTableName
(
'policy_codes'
);
...
...
@@ -36,11 +36,11 @@ class PolicyCode extends Doctrine_Record {
}
public
function
setUp
(){
$this
->
index
(
'code'
,
array
(
'fields'
=>
'code'
));
#
$this->index('code', array('fields' => 'code'));
}
}
class
LiabilityCode
extends
Doctrine_Record
{
class
LiabilityCode
N
extends
Doctrine_Record
{
public
function
setTableDefinition
(){
$this
->
setTableName
(
'liability_codes'
);
...
...
@@ -50,11 +50,11 @@ class LiabilityCode extends Doctrine_Record {
}
public
function
setUp
(){
$this
->
index
(
'code'
,
array
(
'fields'
=>
'code'
));
#
$this->index('code', array('fields' => 'code'));
}
}
class
Policy
extends
Doctrine_Record
{
class
Policy
N
extends
Doctrine_Record
{
public
function
setTableDefinition
(){
$this
->
setTableName
(
'policies'
);
...
...
@@ -64,12 +64,12 @@ class Policy extends Doctrine_Record {
}
public
function
setUp
(){
$this
->
hasOne
(
'Rate'
,
array
(
'local'
=>
'rate_id'
,
'foreign'
=>
'id'
));
$this
->
hasOne
(
'Rate
N
'
,
array
(
'local'
=>
'rate_id'
,
'foreign'
=>
'id'
));
}
}
class
Rate
extends
Doctrine_Record
{
class
Rate
N
extends
Doctrine_Record
{
public
function
setTableDefinition
(){
$this
->
setTableName
(
'rates'
);
...
...
@@ -81,12 +81,12 @@ class Rate extends Doctrine_Record{
}
public
function
setUp
(){
$this
->
index
(
'policy_code_idx'
,
array
(
'fields'
=>
'policy_code'
));
$this
->
index
(
'coverage_code_idx'
,
array
(
'fields'
=>
'coverage_code'
));
$this
->
index
(
'liability_code_idx'
,
array
(
'fields'
=>
'liability_code'
));
$this
->
hasOne
(
'PolicyCode'
,
array
(
'local'
=>
'policy_code'
,
'foreign'
=>
'code'
));
$this
->
hasOne
(
'CoverageCode'
,
array
(
'local'
=>
'coverage_code'
,
'foreign'
=>
'code'
));
$this
->
hasOne
(
'LiabilityCode'
,
array
(
'local'
=>
'liability_code'
,
'foreign'
=>
'code'
));
#
$this->index('policy_code_idx', array('fields' => 'policy_code'));
#
$this->index('coverage_code_idx', array('fields' => 'coverage_code'));
#
$this->index('liability_code_idx', array('fields' => 'liability_code'));
$this
->
hasOne
(
'PolicyCode
N
'
,
array
(
'local'
=>
'policy_code'
,
'foreign'
=>
'code'
));
$this
->
hasOne
(
'CoverageCode
N
'
,
array
(
'local'
=>
'coverage_code'
,
'foreign'
=>
'code'
));
$this
->
hasOne
(
'LiabilityCode
N
'
,
array
(
'local'
=>
'liability_code'
,
'foreign'
=>
'code'
));
}
}
...
...
@@ -96,50 +96,50 @@ class Doctrine_TicketNjero_TestCase extends Doctrine_UnitTestCase
public
function
prepareData
()
{
}
public
function
prepareTables
()
{
$this
->
tables
[]
=
'CoverageCode'
;
$this
->
tables
[]
=
'PolicyCode'
;
$this
->
tables
[]
=
'LiabilityCode'
;
$this
->
tables
[]
=
'Policy'
;
$this
->
tables
[]
=
'Rate'
;
$this
->
tables
[]
=
'CoverageCode
N
'
;
$this
->
tables
[]
=
'PolicyCode
N
'
;
$this
->
tables
[]
=
'LiabilityCode
N
'
;
$this
->
tables
[]
=
'Policy
N
'
;
$this
->
tables
[]
=
'Rate
N
'
;
parent
::
prepareTables
();
}
public
function
testHasOneMultiLevelRelations
()
{
$policy_code
=
new
PolicyCode
();
$policy_code
=
new
PolicyCode
N
();
$policy_code
->
code
=
1
;
$policy_code
->
description
=
"Special Policy"
;
$policy_code
->
save
();
$coverage_code
=
new
CoverageCode
();
$coverage_code
=
new
CoverageCode
N
();
$coverage_code
->
code
=
1
;
$coverage_code
->
description
=
"Full Coverage"
;
$coverage_code
->
save
();
$liability_code
=
new
LiabilityCode
();
$liability_code
=
new
LiabilityCode
N
();
$liability_code
->
code
=
1
;
$liability_code
->
description
=
"Limited Territory"
;
$liability_code
->
save
();
$rate
=
new
Rate
();
$rate
=
new
Rate
N
();
$rate
->
policy_code
=
1
;
$rate
->
coverage_code
=
1
;
$rate
->
liability_code
=
1
;
$rate
->
total_rate
=
123.45
;
$rate
->
save
();
$policy
=
new
Policy
();
$policy
=
new
Policy
N
();
$policy
->
rate_id
=
1
;
$policy
->
policy_number
=
"123456789"
;
$policy
->
save
();
$q
=
new
Doctrine_Query
();
$p
=
$q
->
from
(
"Policy p"
)
$p
=
$q
->
from
(
"Policy
N
p"
)
->
where
(
"p.id = 1"
)
->
execute
()
->
getFirst
();
$this
->
assertEqual
(
$p
->
rate_id
,
1
);
$this
->
assertEqual
(
$p
->
Rate
->
id
,
2
);
$this
->
assertEqual
(
$p
->
Rate
N
->
id
,
1
);
}
}
?>
...
...
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