PhpMyObject
[ class tree: PhpMyObject ] [ index: PhpMyObject ] [ all elements ]

Source for file PMO_MyRequest_Test.php

Documentation is available at PMO_MyRequest_Test.php

  1. <?php
  2. /**
  3.  * This file contains the PMO_MyRequest tests.
  4.  *
  5.  * This file is part of the PhpMyObject project,
  6.  * an Object-Relational Mapping (ORM) system.
  7.  * 
  8.  * For questions, help, comments, discussion, etc., please join our
  9.  * forum at {@link http://www.developpez.net/forums/forumdisplay.php?f=770}
  10.  * or our mailing list at {@link http://groups.google.com/group/pmo-dev}.
  11.  *
  12.  * PhpMyObject is free software: you can redistribute it and/or modify
  13.  * it under the terms of the GNU General Public License as published by
  14.  * the Free Software Foundation, either version 3 of the License, or
  15.  * (at your option) any later version.
  16.  *
  17.  * This program is distributed in the hope that it will be useful,
  18.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.    See the
  20.  * GNU General Public License for more details.
  21.  *
  22.  * You should have received a copy of the GNU General Public License
  23.  * along with this program.  If not, see {@link http://www.gnu.org/licenses/}.
  24.  *
  25.  * @package            PhpMyObject
  26.  * @subpackage        PMO_Tests
  27.  * @author            Nicolas Boiteux <nicolas_boiteux@yahoo.fr>
  28.  * @author            Nicolas Boiteux <nicolas_boiteux@yahoo.fr>
  29.  * @link                http://pmo.developpez.com/
  30.  * @since            PhpMyObject v0.15
  31.  * @version            $Revision: 408 $
  32.  * @copyright        Copyright (C) 2007-2008 Nicolas Boiteux
  33.  * @license            GPLv3 {@link http://www.gnu.org/licenses/gpl}
  34.  * @filesource
  35.  *
  36.  */ 
  37.  
  38. /**
  39.  * setup this test case if called individually
  40.  */
  41. if (!defined('PMO_TEST_SUITE')) {
  42.     require_once(dirname(dirname(__FILE__)).DIRECTORY_SEPARATOR.'config.php');
  43.     require_once(SIMPLETEST.DS.'autorun.php');
  44. }
  45.  
  46.  
  47. /**
  48.  * requires the PMO_MyController which includes everything needed
  49.  */
  50. require_once(PMO_CORE DS 'PMO_Controller.php');
  51.  
  52. /**
  53.  * requires our basic PMO_MyTest template
  54.  */
  55. require_once(dirname(__FILE__).DS.'PMO_MyTest.php');
  56.  
  57. /**
  58.  * tests the PMO_MyRequest class
  59.  */
  60. {
  61.     public function __construct({
  62.         parent::__construct();
  63.         $this->setData();
  64.     }
  65.  
  66.     function test_simple_request({
  67.         $controller new PMO_MyController;
  68.         $request new PMO_MyRequest;
  69.  
  70.         // replicates test 26
  71.         $request->from('film_actor')->limit(5);
  72.         $map $controller->objectquery($request);
  73.         $this->assertTrue(($map instanceof PMO_Map)'controller returned a PMO_Map');
  74.  
  75.         // then we make sure we have the right number of rows
  76.         $this->assertEqual($map->count()5);
  77.  
  78.         // and the right data (1, 2, last)
  79.         $result $map->fetch();
  80.         $this->assertEqual($result['film_actor']->film_id1);
  81.         $result $map->fetch();
  82.         $this->assertEqual($result['film_actor']->film_id23);
  83.         $result $map->fetch();
  84.         $result $map->fetch();
  85.         $result $map->fetch();
  86.         $this->assertEqual($result['film_actor']->film_id140);
  87.     }
  88.  
  89.  
  90. }
  91.  
  92.  
  93.  
  94. // run the tests if called individually
  95. if (!defined('PMO_TEST_SUITE')) {
  96.     $level '';
  97.     if (isset($_GET['level']))
  98.         $level $_GET['level'];
  99.  
  100.     $test new TestSuite('PMO_MyRequest Tests');
  101.     $test->add(new PMO_MyRequest_Test);
  102.     $test->run(new PMO_HTMLReporter($level));
  103. }

Documentation generated on Wed, 15 Oct 2008 09:17:47 -0400 by phpDocumentor 1.4.1