From 4516678f5c0097cce350b714bd35a3b692ac0ed8 Mon Sep 17 00:00:00 2001 From: tamcy Date: Sat, 15 Dec 2007 14:48:00 +0000 Subject: [PATCH] add test case for #626 regarding Doctrine_Table->find() --- tests/Ticket/626DTestCase.php | 58 +++++++++++++++++++++++++++++++++++ tests/run.php | 1 + 2 files changed, 59 insertions(+) create mode 100644 tests/Ticket/626DTestCase.php diff --git a/tests/Ticket/626DTestCase.php b/tests/Ticket/626DTestCase.php new file mode 100644 index 000000000..b80504c63 --- /dev/null +++ b/tests/Ticket/626DTestCase.php @@ -0,0 +1,58 @@ + + * @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 ()); + } +} diff --git a/tests/run.php b/tests/run.php index 7aceaf0a0..6d638f6ef 100644 --- a/tests/run.php +++ b/tests/run.php @@ -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)