. */ require_once('../draft/new-core/Record.php'); require_once('../draft/new-core/Hydrate.php'); require_once('../draft/new-core/Query.php'); require_once('../draft/new-core/Collection.php'); /** * Doctrine_NewCore_TestCase * * @package Doctrine * @author Konsta Vesterinen * @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_NewCore_TestCase extends Doctrine_UnitTestCase { protected $testData1 = array( array( 'e' => array('id' => 1, 'name' => 'zYne'), 'p' => array('id' => 1, 'phonenumber' => '123 123', 'user_id' => 1) ), array( 'e' => array('id' => 2, 'name' => 'John'), 'p' => array('id' => 2, 'phonenumber' => '222 222', 'user_id' => 2) ), array( 'e' => array('id' => 3, 'name' => 'Arnold'), 'p' => array('id' => 3, 'phonenumber' => '333 333', 'user_id' => 3) ) ); public function testExecuteForEmptyAliasMapThrowsException() { $h = new Doctrine_Hydrate_Mock(); try { $h->execute(); $this->fail('Should throw exception'); } catch(Doctrine_Hydrate_Exception $e) { $this->pass(); } } public function testExecuteForEmptyTableAliasMapThrowsException() { $h = new Doctrine_Hydrate_Mock(); $h->setData($this->testData1); $h->setAliasMap(array('u' => array('table' => $this->conn->getTable('User')))); try { $h->execute(); $this->fail('Should throw exception'); } catch(Doctrine_Hydrate_Exception $e) { $this->pass(); } } public function testHydrate() { $h = new Doctrine_Hydrate_Mock(); $h->setData($this->testData1); $h->setAliasMap(array('u' => array('table' => $this->conn->getTable('User')))); $h->setTableAliases(array('e' => 'u')); } } class Doctrine_Hydrate_Mock extends Doctrine_Hydrate2 { protected $data; public function setData($data) { $this->data = $data; } public function _fetch($params = array(), $return = Doctrine::FETCH_RECORD) { return $this->data; } }