CustomPrimaryKeyTestCase.php 790 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14
<?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";
15
        $this->assertEqual($c->obtainIdentifier(), array());
16 17
        
        $c->save();
18
        $this->assertEqual($c->obtainIdentifier(), array("uid" => 1));
zYne's avatar
zYne committed
19
        $this->connection->clear();
20
        
zYne's avatar
zYne committed
21
        $c = $this->connection->getTable('CustomPK')->find(1);
22
    
23
        $this->assertEqual($c->obtainIdentifier(), array("uid" => 1));
24 25 26
    }
}
?>