2006-07-26 21:09:00 +04:00
|
|
|
<?php
|
|
|
|
require_once("UnitTestCase.php");
|
|
|
|
|
|
|
|
class Doctrine_CustomPrimaryKeyTestCase extends Doctrine_UnitTestCase {
|
|
|
|
public function prepareData() { }
|
|
|
|
|
|
|
|
public function prepareTables() {
|
|
|
|
$this->tables = array("CustomPK");
|
|
|
|
}
|
|
|
|
public function testOperations() {
|
|
|
|
$c = new CustomPK();
|
|
|
|
$this->assertTrue($c instanceof Doctrine_Record);
|
|
|
|
|
|
|
|
$c->name = "custom pk test";
|
2006-09-17 21:59:04 +04:00
|
|
|
$this->assertEqual($c->obtainIdentifier(), array());
|
2006-07-26 21:09:00 +04:00
|
|
|
|
|
|
|
$c->save();
|
2006-09-17 21:59:04 +04:00
|
|
|
$this->assertEqual($c->obtainIdentifier(), array("uid" => 1));
|
2006-08-22 03:20:33 +04:00
|
|
|
$this->connection->clear();
|
2006-07-26 21:09:00 +04:00
|
|
|
|
2006-08-22 03:20:33 +04:00
|
|
|
$c = $this->connection->getTable('CustomPK')->find(1);
|
2006-07-26 21:09:00 +04:00
|
|
|
|
2006-09-17 21:59:04 +04:00
|
|
|
$this->assertEqual($c->obtainIdentifier(), array("uid" => 1));
|
2006-07-26 21:09:00 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|