CustomPrimaryKeyTestCase.php 757 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<?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";
        $this->assertEqual($c->getID(), array());
        
        $c->save();
        $this->assertEqual($c->getID(), 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 24 25 26
    
        $this->assertEqual($c->getID(), array("uid" => 1));
    }
}
?>