1
0
mirror of synced 2025-01-29 19:41:45 +03:00

add test case for #626 regarding Doctrine_Table->find()

This commit is contained in:
tamcy 2007-12-15 14:48:00 +00:00
parent 2af9fb80ce
commit 4516678f5c
2 changed files with 59 additions and 0 deletions

View File

@ -0,0 +1,58 @@
<?php
/**
* Doctrine_Ticket_626D_TestCase
*
* @package Doctrine
* @author Tamcy <7am.online@gmail.com>
* @license http://www.opensource.org/licenses/lgpl-license.php LGPL
* @category Object Relational Mapping
* @link www.phpdoctrine.com
* @since 1.0
* @version $Revision$
*/
class Doctrine_Ticket_626D_TestCase extends Doctrine_UnitTestCase
{
public function prepareData()
{ }
public function prepareTables()
{
$this->tables = array('T626D_Student1');
parent::prepareTables();
}
protected function newStudent($cls, $id, $name)
{
$u = new $cls;
$u->id = $id;
$u->name = $name;
$u->save();
return $u;
}
public function testFieldNames()
{
$student1 = $this->newStudent('T626D_Student1', '07090002', 'First Student');
try {
$student = Doctrine::getTable('T626D_Student1')->find('07090002');
$this->pass();
} catch (Exception $e) {
$this->fail($e->__toString());
}
}
}
class T626D_Student1 extends Doctrine_Record
{
public function setTableDefinition()
{
$this->setTableName('T626D_Student_record_1');
$this->hasColumn('s_id as id', 'varchar', 30, array ( 'primary' => true,));
$this->hasColumn('s_name as name', 'varchar', 50, array ());
}
}

View File

@ -24,6 +24,7 @@ $tickets->addTestCase(new Doctrine_Ticket_642_TestCase());
$tickets->addTestCase(new Doctrine_Ticket_438_TestCase());
$tickets->addTestCase(new Doctrine_Ticket_638_TestCase());
$tickets->addTestCase(new Doctrine_Ticket_673_TestCase());
$tickets->addTestCase(new Doctrine_Ticket_626D_TestCase());
$test->addTestCase($tickets);
// Connection drivers (not yet fully tested)