2007-12-15 17:48:00 +03:00
|
|
|
<?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
|
2008-02-22 21:11:35 +03:00
|
|
|
* @link www.phpdoctrine.org
|
2007-12-15 17:48:00 +03:00
|
|
|
* @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 {
|
2008-05-06 17:41:22 +04:00
|
|
|
$student = $this->conn->getRepository('T626D_Student1')->find('07090002');
|
2007-12-15 17:48:00 +03:00
|
|
|
$this->pass();
|
|
|
|
} catch (Exception $e) {
|
|
|
|
$this->fail($e->__toString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-14 01:20:34 +04:00
|
|
|
class T626D_Student1 extends Doctrine_Entity
|
2007-12-15 17:48:00 +03:00
|
|
|
{
|
2008-02-04 00:29:57 +03:00
|
|
|
public static function initMetadata($class)
|
2007-12-15 17:48:00 +03:00
|
|
|
{
|
2008-02-04 00:29:57 +03:00
|
|
|
$class->setTableName('T626D_Student_record_1');
|
2007-12-15 17:48:00 +03:00
|
|
|
|
2008-02-04 00:29:57 +03:00
|
|
|
$class->setColumn('s_id as id', 'varchar', 30, array ( 'primary' => true,));
|
|
|
|
$class->setColumn('s_name as name', 'varchar', 50, array ());
|
2007-12-15 17:48:00 +03:00
|
|
|
}
|
|
|
|
}
|