1
0
mirror of synced 2025-01-18 06:21:40 +03:00

Make the Njero testcase live for hasOne hydration problem

This commit is contained in:
njero 2007-08-09 22:48:40 +00:00
parent 391bdc88a1
commit 8ba35b6e2b
2 changed files with 15 additions and 6 deletions

View File

@ -11,7 +11,6 @@
* @since 1.0 * @since 1.0
* @version $Revision$ * @version $Revision$
*/ */
class CoverageCodeN extends Doctrine_Record { class CoverageCodeN extends Doctrine_Record {
public function setTableDefinition(){ public function setTableDefinition(){
@ -116,6 +115,11 @@ class Doctrine_TicketNjero_TestCase extends Doctrine_UnitTestCase
$coverage_code->description = "Full Coverage"; $coverage_code->description = "Full Coverage";
$coverage_code->save(); $coverage_code->save();
$coverage_code = new CoverageCodeN();
$coverage_code->code = 3; # note we skip 2
$coverage_code->description = "Partial Coverage";
$coverage_code->save();
$liability_code = new LiabilityCodeN(); $liability_code = new LiabilityCodeN();
$liability_code->code = 1; $liability_code->code = 1;
$liability_code->description = "Limited Territory"; $liability_code->description = "Limited Territory";
@ -123,7 +127,7 @@ class Doctrine_TicketNjero_TestCase extends Doctrine_UnitTestCase
$rate = new RateN(); $rate = new RateN();
$rate->policy_code = 1; $rate->policy_code = 1;
$rate->coverage_code = 1; $rate->coverage_code = 3;
$rate->liability_code = 1; $rate->liability_code = 1;
$rate->total_rate = 123.45; $rate->total_rate = 123.45;
$rate->save(); $rate->save();
@ -134,12 +138,17 @@ class Doctrine_TicketNjero_TestCase extends Doctrine_UnitTestCase
$policy->save(); $policy->save();
$q = new Doctrine_Query(); $q = new Doctrine_Query();
$p = $q->from("PolicyN p") $p = $q->from('PolicyN p, p.RateN r, r.PolicyCodeN y, r.CoverageCodeN c, r.LiabilityCodeN l')
->where("p.id = 1") ->where('(p.id = ?)', array('1'))
->execute() ->execute()
->getFirst(); ->getFirst();
$this->assertEqual($p->rate_id, 1); $this->assertEqual($p->rate_id, 1);
$this->assertEqual($p->RateN->id, 1); $this->assertEqual($p->RateN->id, 1);
$this->assertEqual($p->RateN->policy_code, 1);
$this->assertEqual($p->RateN->coverage_code, 3);
$this->assertEqual($p->RateN->liability_code, 1);
echo "The following should be '3' or there should have been an assertion failure: " . $p->RateN->coverage_code . "\n";
} }
} ?> } ?>

View File

@ -72,7 +72,7 @@ $test->addTestCase(new Doctrine_Ticket330_TestCase());
*/ */
/** */ /** */
//$test->addTestCase(new Doctrine_TicketNjero_TestCase()); $test->addTestCase(new Doctrine_TicketNjero_TestCase());
// Connection drivers (not yet fully tested) // Connection drivers (not yet fully tested)