Source for file PMO_MyRequest_Test.php
Documentation is available at PMO_MyRequest_Test.php
* This file contains the PMO_MyRequest tests.
* This file is part of the PhpMyObject project,
* an Object-Relational Mapping (ORM) system.
* For questions, help, comments, discussion, etc., please join our
* forum at {@link http://www.developpez.net/forums/forumdisplay.php?f=770}
* or our mailing list at {@link http://groups.google.com/group/pmo-dev}.
* PhpMyObject is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see {@link http://www.gnu.org/licenses/}.
* @author Nicolas Boiteux <nicolas_boiteux@yahoo.fr>
* @author Nicolas Boiteux <nicolas_boiteux@yahoo.fr>
* @link http://pmo.developpez.com/
* @since PhpMyObject v0.15
* @version $Revision: 408 $
* @copyright Copyright (C) 2007-2008 Nicolas Boiteux
* @license GPLv3 {@link http://www.gnu.org/licenses/gpl}
* setup this test case if called individually
require_once(dirname(dirname(__FILE__ )). DIRECTORY_SEPARATOR. 'config.php');
require_once(SIMPLETEST. DS. 'autorun.php');
* requires the PMO_MyController which includes everything needed
require_once(PMO_CORE . DS . 'PMO_Controller.php');
* requires our basic PMO_MyTest template
require_once(dirname(__FILE__ ). DS. 'PMO_MyTest.php');
* tests the PMO_MyRequest class
$request->from('film_actor')->limit(5);
$map = $controller->objectquery($request);
$this->assertTrue(($map instanceof PMO_Map), 'controller returned a PMO_Map');
// then we make sure we have the right number of rows
$this->assertEqual($map->count(), 5);
// and the right data (1, 2, last)
$this->assertEqual($result['film_actor']->film_id, 1);
$this->assertEqual($result['film_actor']->film_id, 23);
$this->assertEqual($result['film_actor']->film_id, 140);
// run the tests if called individually
if (isset ($_GET['level']))
$test = new TestSuite('PMO_MyRequest Tests');
$test->run(new PMO_HTMLReporter($level));
|