[ Index ]
 

Code source de PHPonTrax 2.6.6-svn

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/test/ -> ActiveRecordTest.php (source)

   1  <?php
   2  /**
   3   *  File for the ActiveRecordTest class
   4   *
   5   * (PHP 5)
   6   *
   7   * @package PHPonTraxTest
   8   * @license http://opensource.org/licenses/gpl-license.php GNU Public License
   9   * @copyright (c) Walter O. Haas 2006
  10   * @version $Id: ActiveRecordTest.php 208 2006-05-28 17:59:55Z john $
  11   * @author Walt Haas <haas@xmission.com>
  12   */
  13  
  14  echo "testing ActiveRecord\n";
  15  require_once  'testenv.php';
  16  
  17  //  We need to load a mock DB class to test ActiveRecord.
  18  //  Change the include path to put the mockDB/ directory first, so
  19  //  that when ActiveRecord loads it will pick up the mock class.
  20  @ini_set('include_path','./mockDB:'.ini_get('include_path'));
  21  require_once "active_record.php";
  22  
  23  // Call ActiveRecordTest::main() if this source file is executed directly.
  24  if (!defined("PHPUnit2_MAIN_METHOD")) {
  25      define("PHPUnit2_MAIN_METHOD", "ActiveRecordTest::main");
  26  }
  27  
  28  require_once "PHPUnit2/Framework/TestCase.php";
  29  require_once "PHPUnit2/Framework/TestSuite.php";
  30  
  31  /**
  32   *  Require classes that are too trivial to bother making mocks
  33   */
  34  require_once 'trax_exceptions.php';
  35  require_once 'inflector.php';
  36  
  37  // You may remove the following line when all tests have been implemented.
  38  require_once "PHPUnit2/Framework/IncompleteTestError.php";
  39  
  40  // Set Trax operating mode
  41  define("TRAX_ENV",   "development");
  42  
  43  /**
  44   *  Regression tester for the ActiveRecord class
  45   *
  46   *  This class is used only in regression testing of the ActiveRecord
  47   *  class, but you might find some useful examples by reading it.
  48   */
  49    class PersonName extends ActiveRecord {
  50        //  Function to validate prefix attribute
  51        function validate_prefix() {
  52            if ($this->prefix == '') {
  53                return array(false, "prefix empty");
  54            } else {
  55                return array(true);
  56            }
  57        }
  58  
  59        //  Create another copy of this class
  60        function new_obj($attributes) {
  61            return $this->create($attributes);
  62        }
  63  }
  64  
  65  class DB_find_all_result extends DB_result {
  66      // Data to be returned by fetchMode
  67      private $data = array(array('id' => '17',
  68                                  'prefix' => '',
  69                                  'first_name' => 'Ben',
  70                                  'mi' => '',
  71                                  'last_name' => 'Dover',
  72                                  'suffix' => ''),
  73                            array('id' => '23',
  74                                  'prefix' => '',
  75                                  'first_name' => 'Eileen',
  76                                  'mi' => '',
  77                                  'last_name' => 'Dover',
  78                                  'suffix' => '')
  79                            );
  80  
  81      private $row_num = 0;
  82  
  83      function fetchRow() {
  84          if ($this->row_num >= count($this->data)) {
  85              return null;
  86          }
  87          return $this->data[$this->row_num++];
  88      }
  89  }
  90  
  91  /**
  92   * Test class for {@link ActiveRecord}
  93   */
  94  class ActiveRecordTest extends PHPUnit2_Framework_TestCase {
  95  
  96      /**
  97       * Runs the test methods of this class.
  98       *
  99       * @access public
 100       * @static
 101       */
 102      public static function main() {
 103          require_once "PHPUnit2/TextUI/TestRunner.php";
 104  
 105          $suite  = new PHPUnit2_Framework_TestSuite("ActiveRecordTest");
 106          $result = PHPUnit2_TextUI_TestRunner::run($suite);
 107      }
 108  
 109      /**
 110       *  Set the environment ActiveRecord expects
 111       */
 112      protected function setUp() {
 113  
 114          //  Force constructor to get a connection
 115          Trax::$active_record_connections = array();
 116  
 117          // Set up information that normally comes from database.ini
 118          Trax::$database_settings[TRAX_ENV]
 119              = array('phptype'    => 'mysql',
 120                      'database'   => 'database_development',
 121                      'hostspec'   => 'localhost',
 122                      'username'   => 'root',
 123                      'password'   => '',
 124                      'persistent' => true);
 125      }
 126  
 127      /**
 128       *  This method is called after a test is executed.
 129       */
 130      protected function tearDown() {
 131      }
 132  
 133      /**
 134       *  Test constructor
 135       */
 136      public function test__construct() {
 137          $p = new PersonName;
 138          $this->assertEquals(get_class($p), 'PersonName');
 139          $this->assertEquals($p->table_name, 'person_names');
 140          $this->assertTrue(Trax::$active_record_connections[TRAX_ENV]->options['persistent']);
 141          //  We don't completely check content_columns
 142          $this->assertTrue(is_array($p->content_columns));
 143          $this->assertEquals(count($p->content_columns),6);
 144          //  There are a lot of notice level error messages in normal
 145          //  operation.  We know about them and don't want to confuse
 146          //  testing with them. 
 147          error_reporting(E_USER_WARNING);
 148  
 149          $p = new PersonName(array('id' => '17', 'first_name' => 'Boris',
 150                                    'last_name' => 'Tudeth'));
 151          $this->assertEquals($p->first_name,'Boris');
 152          $this->assertEquals($p->last_name,'Tudeth');
 153          error_reporting(E_USER_NOTICE);
 154      }
 155  
 156      /**
 157       *  Test the get_attributes() method
 158       */
 159      public function testGet_attributes() {
 160          $p = new PersonName;
 161          //  Constructor initializes all attributes to null
 162          //  There are a lot of notice level error messages in normal
 163          //  operation.  We know about them and don't want to confuse
 164          //  testing with them. 
 165          error_reporting(E_USER_WARNING);
 166          $attrs = $p->get_attributes();
 167          $this->assertEquals($attrs,array('id'         => null,
 168                                           'prefix'     => null,
 169                                           'first_name' => null,
 170                                           'mi'         => null,
 171                                           'last_name'  => null,
 172                                           'suffix'     => null));
 173          //  Assign some attribute values
 174          $p->id         = 17;
 175          $p->prefix     = 'Dr.';
 176          $p->first_name = 'Anon';
 177          $p->mi         = 'E';
 178          $p->last_name  = 'Moose';
 179          $p->suffix     = 'Ph.D.';
 180  
 181          //  This shouldn't produce notice level messages
 182          error_reporting(E_USER_NOTICE);
 183  
 184          //  get_attributes() should return the same values
 185          $attrs = $p->get_attributes();
 186          $this->assertEquals($attrs,array('id'         => 17,
 187                                           'prefix'     => 'Dr.',
 188                                           'first_name' => 'Anon',
 189                                           'mi'         => 'E',
 190                                           'last_name'  => 'Moose',
 191                                           'suffix'     => 'Ph.D.'));
 192      }
 193  
 194      /**
 195       *  Test the update_attributes() method
 196       *  @todo Figure out the datetime thing and how to test it
 197       */
 198      public function testUpdate_attributes() {
 199          $p = new PersonName;
 200          $p->update_attributes(array('id'         => 17,
 201                                      'prefix'     => 'Dr.',
 202                                      'first_name' => 'Anon',
 203                                      'mi'         => 'E',
 204                                      'last_name'  => 'Moose',
 205                                      'suffix'     => 'Ph.D.'));
 206          $attrs = $p->get_attributes();
 207          $this->assertEquals($attrs,array('id'         => 17,
 208                                           'prefix'     => 'Dr.',
 209                                           'first_name' => 'Anon',
 210                                           'mi'         => 'E',
 211                                           'last_name'  => 'Moose',
 212                                           'suffix'     => 'Ph.D.'));
 213          // Remove the following line when you complete this test.
 214          throw new PHPUnit2_Framework_IncompleteTestError;
 215      }
 216  
 217      /**
 218       *  Test the quoted_attributes() method
 219       *  @todo Figure out how to test timestamp updating
 220       */
 221      public function testQuoted_attributes() {
 222          $p = new PersonName;
 223          //  Constructor initializes all attributes to null.
 224          //  quoted_attributes() returns null as null string
 225          $attrs = $p->quoted_attributes();
 226          $this->assertEquals($attrs,array('id'         => "''",
 227                                           'prefix'     => "''",
 228                                           'first_name' => "''",
 229                                           'mi'         => "''",
 230                                           'last_name'  => "''",
 231                                           'suffix'     => "''"));
 232          //  Assign some attribute values
 233          $p->id         = 17;
 234          $p->prefix     = '"Dr."';
 235          $p->first_name = 'Nobody';
 236          $p->mi         = 'X';
 237          $p->last_name  = 'O\'Reilly';
 238          $p->suffix     = 'Back\\slash';
 239          //  Get attributes with quotes
 240          $attrs = $p->quoted_attributes();
 241          $this->assertEquals($attrs,array('id'         => "'17'",
 242                                           'prefix'     => "'\\\"Dr.\\\"'",
 243                                           'first_name' => "'Nobody'",
 244                                           'mi'         => "'X'",
 245                                           'last_name'  => "'O\'Reilly'",
 246                                           'suffix'     => "'Back\\\\slash'"));
 247          // Test the optional argument
 248          $p = new PersonName;
 249          $attrs = $p->quoted_attributes(
 250                                 array('id'         => 17,
 251                                       'prefix'     => '"Dr."',
 252                                       'first_name' => 'Nobody',
 253                                       'mi'         => 'X',
 254                                       'last_name'  => 'O\'Reilly',
 255                                       'suffix'     => 'Back\\slash'));
 256          $this->assertEquals($attrs,array('id'         => "'17'",
 257                                           'prefix'     => "'\\\"Dr.\\\"'",
 258                                           'first_name' => "'Nobody'",
 259                                           'mi'         => "'X'",
 260                                           'last_name'  => "'O\'Reilly'",
 261                                           'suffix'     => "'Back\\\\slash'"));
 262      }
 263  
 264      /**
 265       *  Test the validate_model_attributes() method
 266       */
 267      public function testValidate_model_attributes() {
 268          $p = new PersonName;
 269          $p->update_attributes(array('id'         => 17,
 270                                      'prefix'     => 'Dr.',
 271                                      'first_name' => 'Anon',
 272                                      'mi'         => 'E',
 273                                      'last_name'  => 'Moose',
 274                                      'suffix'     => 'Ph.D.'));
 275          //  With failing validation, should return false and error msg
 276          $p->prefix = '';
 277          $result = $p->validate_model_attributes();
 278          $this->assertFalse($result);
 279          $this->assertEquals(count($p->errors),1);
 280          $this->assertEquals($p->errors['prefix'], 'prefix empty');
 281      }
 282  
 283      /**
 284       *  Test the query() method
 285       */
 286      public function testQuery() {
 287          //  Test normal case: send query, get result
 288          $p = new PersonName;
 289          Trax::$active_record_connections[TRAX_ENV]->expect_query('foo','bar');
 290          $result = $p->query('foo');
 291          $this->assertEquals($result,'bar');
 292      }
 293  
 294      /**
 295       *  Test the get_insert_id() method
 296       */
 297      public function testGet_insert_id() {
 298          $p = new PersonName;
 299          Trax::$active_record_connections[TRAX_ENV]->expect_query("SELECT LAST_INSERT_ID();",
 300                                                     '17');
 301          $result =& $p->get_insert_id();
 302          $this->assertEquals($result,'17');
 303      }
 304  
 305      /**
 306       *  Test the is_error() method
 307       */
 308      public function testIs_error() {
 309          $p = new PersonName;
 310          //  Create a new harmless object, test it's not an error
 311          $obj = new PHPUnit2_Framework_Assert;
 312          $this->assertFalse($p->is_error($obj));
 313          //  Create a PHP 4 error, test it is detected
 314          $obj = new PEAR_Error('testing');
 315          $this->assertTrue($p->is_error($obj));
 316          //  Create a DB error, test it is detected
 317          $obj = new DB_Error('testing');
 318          $this->assertTrue($p->is_error($obj));
 319      }
 320  
 321      /**
 322       *  Test the get_primary_key_conditions() method
 323       */
 324      public function testGet_primary_key_conditions() {
 325          $p = new PersonName;
 326          //  Default is primary key is 'id', no value
 327          $result = $p->get_primary_key_conditions();
 328          $this->assertEquals($result,"id = ''");
 329          //  Now give the primary key a value
 330          $p->id = 11;
 331          $result = $p->get_primary_key_conditions();
 332          $this->assertEquals($result,"id = '11'");
 333          //  Try a different column as primary key
 334          $p->primary_keys=array('last_name');
 335          $result = $p->get_primary_key_conditions();
 336          $this->assertEquals($result,"last_name = ''");
 337          $p->last_name = "Smith";
 338          $result = $p->get_primary_key_conditions();
 339          $this->assertEquals($result,"last_name = 'Smith'");
 340          //  Try two columns as primary key
 341          $p->primary_keys=array('id', 'last_name');
 342          $result = $p->get_primary_key_conditions();
 343          $this->assertEquals($result,"id = '11' AND last_name = 'Smith'");
 344      }
 345  
 346      /**
 347       *  Test the get_updates_sql() method
 348       */
 349      public function testGet_updates_sql() {
 350          //  Apply some attributes
 351          $p = new PersonName;
 352          $p->id         = 17;
 353          $p->prefix     = 'Dr.';
 354          $p->first_name = 'Anon';
 355          $p->mi         = 'E';
 356          $p->last_name  = 'Moose';
 357          $p->suffix     = 'Ph.D.';
 358          $result = $p->get_updates_sql();
 359          $this->assertEquals($result,
 360                         "prefix = 'Dr.', first_name = 'Anon',"
 361                        ." mi = 'E', last_name = 'Moose', suffix = 'Ph.D.'");
 362          //  Assign some attribute values that need to be quoted
 363          $p = new PersonName;
 364          $p->id         = 17;
 365          $p->prefix     = '"Dr."';
 366          $p->first_name = 'Nobody';
 367          $p->mi         = 'X';
 368          $p->last_name  = 'O\'Reilly';
 369          $p->suffix     = 'Back\\slash';
 370          $result = $p->get_updates_sql();
 371          $this->assertEquals($result,
 372               "prefix = '\\\"Dr.\\\"', first_name = 'Nobody',"
 373              ." mi = 'X', last_name = 'O\'Reilly', suffix = 'Back\\\\slash'");
 374      }
 375  
 376      /**
 377       *  Test the save() method
 378       *  @todo Write test of save() of existing row
 379       */
 380      public function testSave() {
 381          //  A valid new row should be inserted
 382          $p = new PersonName;
 383          Trax::$active_record_connections[TRAX_ENV]->expect_queries(array(
 384            array('query' => "INSERT INTO person_names"
 385               ." (id, prefix, first_name, mi, last_name, suffix)"
 386               ." VALUES ('', 'Dr.', 'Anon', 'E', 'Moose', 'Ph.D.')",
 387                  'result' => DB_OK),
 388            array('query' => "SELECT LAST_INSERT_ID();",
 389                  'result' => '17')));
 390          $result = $p->save(array('prefix'     => 'Dr.',
 391                                   'first_name' => 'Anon',
 392                                   'mi'         => 'E',
 393                                   'last_name'  => 'Moose',
 394                                   'suffix'     => 'Ph.D.'));
 395          $this->assertTrue($result);
 396          //  Verify DB received all expected queries
 397          Trax::$active_record_connections[TRAX_ENV]->tally_queries();
 398  
 399          // An invalid row should fail immediately
 400          $p = new PersonName;
 401          $result = $p->save(array('first_name' => 'Anon',
 402                                   'mi'         => 'E',
 403                                   'last_name'  => 'Moose',
 404                                   'suffix'     => 'Ph.D.'));
 405          $this->assertFalse($result);
 406          $this->assertEquals(count($p->errors),1);
 407          $this->assertEquals($p->errors['prefix'], 'prefix empty');
 408  
 409          //  An invalid new row with validation disabled should be inserted
 410          $p = new PersonName;
 411          Trax::$active_record_connections[TRAX_ENV]->expect_queries(array(
 412            array('query' => "INSERT INTO person_names"
 413               ." (id, prefix, first_name, mi, last_name, suffix)"
 414               ." VALUES ('', '', 'Anon', 'E', 'Moose', 'Ph.D.')",
 415                  'result' => DB_OK),
 416            array('query' => "SELECT LAST_INSERT_ID();",
 417                  'result' => '17')));
 418          $result = $p->save(array('first_name' => 'Anon',
 419                                   'mi'         => 'E',
 420                                   'last_name'  => 'Moose',
 421                                   'suffix'     => 'Ph.D.'),true);
 422          $this->assertTrue($result);
 423          //  Verify DB received all expected queries
 424          Trax::$active_record_connections[TRAX_ENV]->tally_queries();
 425          // Remove the following line when you complete this test.
 426          throw new PHPUnit2_Framework_IncompleteTestError;
 427      }
 428  
 429      /**
 430       *  Test the add_error() method
 431       */
 432      public function testAdd_error() {
 433          $p = new PersonName;
 434          $this->assertTrue(is_array($p->errors));
 435          $this->assertEquals(count($p->errors),0);
 436          $p->add_error('mumble is scrogged','mumble');
 437          $this->assertEquals($p->errors,
 438                              array('mumble' => 'mumble is scrogged'));
 439          $p->add_error('veeblefitzer foobar');
 440          $this->assertEquals($p->errors,
 441                              array('mumble' => 'mumble is scrogged',
 442                                    '0' => 'veeblefitzer foobar'));
 443      }
 444  
 445  
 446      /**
 447       *  Test the find_all() method
 448       *  @todo Tests for limit, joins parameters
 449       */
 450      public function testFind_all() {
 451  
 452          //  Test return of the entire table
 453          $p = new PersonName;
 454          Trax::$active_record_connections[TRAX_ENV]->expect_query(
 455                   "SELECT * FROM person_names ",
 456                   new DB_find_all_result);
 457          $result = $p->find_all();
 458          $this->assertTrue(is_array($result));
 459          $this->assertEquals(count($result),2);
 460          $this->assertEquals(get_class($result[17]),'PersonName');
 461          $this->assertEquals($result[17]->first_name,'Ben');
 462          $this->assertEquals(get_class($result[23]),'PersonName');
 463          $this->assertEquals($result[23]->first_name,'Eileen');
 464  
 465          //  Conditions including "SELECT" should pass thru unedited
 466          $p = new PersonName;
 467          Trax::$active_record_connections[TRAX_ENV]->expect_query(
 468                   "SELECT mumble,foo FROM person_names",
 469                   new DB_find_all_result);
 470          $result = $p->find_all("SELECT mumble,foo FROM person_names");
 471          $this->assertTrue(is_array($result));
 472  
 473          //  Conditions without "SELECT" should appear in WHERE clause
 474          $p = new PersonName;
 475          Trax::$active_record_connections[TRAX_ENV]->expect_query(
 476                   "SELECT * FROM person_names WHERE last_name = 'Dover' ",
 477                   new DB_find_all_result);
 478          $result = $p->find_all("last_name = 'Dover'");
 479          $this->assertTrue(is_array($result));
 480  
 481          //  Orderings should appear in ORDER BY clause
 482          $p = new PersonName;
 483          Trax::$active_record_connections[TRAX_ENV]->expect_query(
 484                   "SELECT * FROM person_names ORDER BY last_name ",
 485                   new DB_find_all_result);
 486          $result = $p->find_all(null, "last_name");
 487          $this->assertTrue(is_array($result));
 488  
 489          //  Test limit
 490          //Trax::$active_record_connections[TRAX_ENV]->expect_query(
 491          //         "SELECT * FROM person_names WHERE last_name = 'Dover' "
 492          //         . "ORDER BY last_name ",
 493          //         new DB_find_all_result);
 494          //$result = $p->find_all("last_name = 'Dover'", "last_name",
 495          //                       array(1,20));
 496  
 497          //  Test joins
 498  
 499          // Remove the following line when you implement this test.
 500          throw new PHPUnit2_Framework_IncompleteTestError;
 501      }
 502  
 503      /**
 504       *  Test the find_first() method
 505       *  @todo Tests for joins parameter
 506       */
 507      public function testFind_first() {
 508          $p = new PersonName;
 509          Trax::$active_record_connections[TRAX_ENV]->expect_query(
 510                   "SELECT * FROM person_names WHERE last_name = 'Dover' ",
 511                   new DB_find_all_result);
 512          $result = $p->find_first("last_name = 'Dover'");
 513          $this->assertEquals(get_class($result),'PersonName');
 514          $this->assertEquals($result->id,'17');
 515          // Remove the following line when you implement this test.
 516          throw new PHPUnit2_Framework_IncompleteTestError;
 517      }
 518  
 519      /**
 520       *  Test the find() method
 521       *  @todo Tests for limit, joins parameters
 522       */
 523      public function testFind() {
 524          $p = new PersonName;
 525  
 526          //  Find by a single id value
 527          Trax::$active_record_connections[TRAX_ENV]->expect_query(
 528                   "SELECT * FROM person_names WHERE id='17' ",
 529                   new DB_find_all_result);
 530          $result = $p->find(17);
 531          $this->assertEquals(get_class($result),'PersonName');
 532          $this->assertEquals($result->id,'17');
 533  
 534          //  Find by an array of id values
 535          Trax::$active_record_connections[TRAX_ENV]->expect_query(
 536                   "SELECT * FROM person_names WHERE id IN(17,23) ",
 537                   new DB_find_all_result);
 538          $result = $p->find(array(17,23));
 539          $this->assertTrue(is_array($result));
 540          $this->assertEquals(count($result),2);
 541          $this->assertEquals(get_class($result[17]),'PersonName');
 542          $this->assertEquals($result[17]->first_name,'Ben');
 543          $this->assertEquals(get_class($result[23]),'PersonName');
 544          $this->assertEquals($result[23]->first_name,'Eileen');
 545  
 546          //  Find by WHERE clause expression
 547          Trax::$active_record_connections[TRAX_ENV]->expect_query(
 548                   "SELECT * FROM person_names WHERE last_name='Dover' ",
 549                   new DB_find_all_result);
 550          $result = $p->find("last_name='Dover'");
 551          //  First matching row should come back
 552          $this->assertEquals(get_class($result),'PersonName');
 553          $this->assertEquals($result->id,'17');
 554          // Remove the following line when you complete this test.
 555          throw new PHPUnit2_Framework_IncompleteTestError;
 556      }
 557  
 558      /**
 559       *  Test the after_create() method
 560       *  @todo Implement testAfter_create()
 561       */
 562      public function testAfter_create() {
 563          // Remove the following line when you implement this test.
 564          throw new PHPUnit2_Framework_IncompleteTestError;
 565      }
 566  
 567      /**
 568       *  Test the after_delete() method
 569       *  @todo Implement testAfter_delete()
 570       */
 571      public function testAfter_delete() {
 572          // Remove the following line when you implement this test.
 573          throw new PHPUnit2_Framework_IncompleteTestError;
 574      }
 575  
 576      /**
 577       *  Test the after_save() method
 578       *  @todo Implement testAfter_save()
 579       */
 580      public function testAfter_save() {
 581          // Remove the following line when you implement this test.
 582          throw new PHPUnit2_Framework_IncompleteTestError;
 583      }
 584  
 585      /**
 586       *  Test the after_update() method
 587       *  @todo Implement testAfter_update()
 588       */
 589      public function testAfter_update() {
 590          // Remove the following line when you implement this test.
 591          throw new PHPUnit2_Framework_IncompleteTestError;
 592      }
 593  
 594      /**
 595       *  Test the after_validation() method
 596       *  @todo Implement testAfter_validation()
 597       */
 598      public function testAfter_validation() {
 599          // Remove the following line when you implement this test.
 600          throw new PHPUnit2_Framework_IncompleteTestError;
 601      }
 602  
 603      /**
 604       *  Test the after_validation_on_create() method
 605       *  @todo Implement testAfter_validation_on_create()
 606       */
 607      public function testAfter_validation_on_create() {
 608          // Remove the following line when you implement this test.
 609          throw new PHPUnit2_Framework_IncompleteTestError;
 610      }
 611  
 612      /**
 613       *  Test the after_validation_on_update() method
 614       *  @todo Implement testAfter_validation_on_update()
 615       */
 616      public function testAfter_validation_on_update() {
 617          // Remove the following line when you implement this test.
 618          throw new PHPUnit2_Framework_IncompleteTestError;
 619      }
 620  
 621      /**
 622       *  Test the avg_all() method
 623       *  @todo Implement testAvg_all()
 624       */
 625      public function testAvg_all() {
 626          // Remove the following line when you implement this test.
 627          throw new PHPUnit2_Framework_IncompleteTestError;
 628      }
 629  
 630      /**
 631       *  Test the before_create() method
 632       *  @todo Implement testBefore_create()
 633       */
 634      public function testBefore_create() {
 635          // Remove the following line when you implement this test.
 636          throw new PHPUnit2_Framework_IncompleteTestError;
 637      }
 638  
 639      /**
 640       *  Test the before_delete() method
 641       *  @todo Implement testBefore_delete()
 642       */
 643      public function testBefore_delete() {
 644          // Remove the following line when you implement this test.
 645          throw new PHPUnit2_Framework_IncompleteTestError;
 646      }
 647  
 648      /**
 649       *  Test the before_save() method
 650       *  @todo Implement testBefore_save()
 651       */
 652      public function testBefore_save() {
 653          // Remove the following line when you implement this test.
 654          throw new PHPUnit2_Framework_IncompleteTestError;
 655      }
 656  
 657      /**
 658       *  Test the before_update() method
 659       *  @todo Implement testBefore_update()
 660       */
 661      public function testBefore_update() {
 662          // Remove the following line when you implement this test.
 663          throw new PHPUnit2_Framework_IncompleteTestError;
 664      }
 665  
 666      /**
 667       *  Test the before_validation() method
 668       *  @todo Implement testBefore_validation()
 669       */
 670      public function testBefore_validation() {
 671          // Remove the following line when you implement this test.
 672          throw new PHPUnit2_Framework_IncompleteTestError;
 673      }
 674  
 675      /**
 676       *  Test the before_validation_on_create() method
 677       *  @todo Implement testBefore_validation_on_create()
 678       */
 679      public function testBefore_validation_on_create() {
 680          // Remove the following line when you implement this test.
 681          throw new PHPUnit2_Framework_IncompleteTestError;
 682      }
 683  
 684      /**
 685       *  Test the before_validation_on_update() method
 686       *  @todo Implement testBefore_validation_on_update()
 687       */
 688      public function testBefore_validation_on_update() {
 689          // Remove the following line when you implement this test.
 690          throw new PHPUnit2_Framework_IncompleteTestError;
 691      }
 692  
 693      /**
 694       *  Test the begin() method
 695       *  @todo Implement testBegin()
 696       */
 697      public function testBegin() {
 698          // Remove the following line when you implement this test.
 699          throw new PHPUnit2_Framework_IncompleteTestError;
 700      }
 701  
 702      /**
 703       *  Test the column_attribute_exists() method
 704       *  @todo Implement testColumn_attribute_exists()
 705       */
 706      public function testColumn_attribute_exists() {
 707          // Remove the following line when you implement this test.
 708          throw new PHPUnit2_Framework_IncompleteTestError;
 709      }
 710  
 711      /**
 712       *  Test the column_for_attribute() method
 713       *  @todo Implement testColumn_for_attribute()
 714       */
 715      public function testColumn_for_attribute() {
 716          // Remove the following line when you implement this test.
 717          throw new PHPUnit2_Framework_IncompleteTestError;
 718      }
 719  
 720      /**
 721       *  Test the commit() method
 722       *  @todo Implement testCommit()
 723       */
 724      public function testCommit() {
 725          // Remove the following line when you implement this test.
 726          throw new PHPUnit2_Framework_IncompleteTestError;
 727      }
 728  
 729      /**
 730       *  Test the count_all() method
 731       *  @todo Implement testCount_all()
 732       */
 733      public function testCount_all() {
 734          // Remove the following line when you implement this test.
 735          throw new PHPUnit2_Framework_IncompleteTestError;
 736      }
 737  
 738      /**
 739       *  Test the create() method
 740       *  @todo Implement testCreate()
 741       */
 742      public function testCreate() {
 743          // Remove the following line when you implement this test.
 744          throw new PHPUnit2_Framework_IncompleteTestError;
 745      }
 746  
 747      /**
 748       *  Test the delete() method
 749       *  @todo Implement testDelete()
 750       */
 751      public function testDelete() {
 752          // Remove the following line when you implement this test.
 753          throw new PHPUnit2_Framework_IncompleteTestError;
 754      }
 755  
 756      /**
 757       *  Test the delete_all() method
 758       *  @todo Implement testDelete_all()
 759       */
 760      public function testDelete_all() {
 761          // Remove the following line when you implement this test.
 762          throw new PHPUnit2_Framework_IncompleteTestError;
 763      }
 764  
 765      /**
 766       *  Test the establish_connection() method
 767       *  @todo Implement testEstablish_connection()
 768       */
 769      public function testEstablish_connection() {
 770          // Remove the following line when you implement this test.
 771          throw new PHPUnit2_Framework_IncompleteTestError;
 772      }
 773  
 774      /**
 775       *  Test the find_by_*() and find_all_by_*() methods
 776       */
 777      public function testFind_by() {
 778          // Test find_by_first_name()
 779          $p = new PersonName;
 780          Trax::$active_record_connections[TRAX_ENV]->expect_query(
 781                   "SELECT * FROM person_names WHERE first_name='Ben' ",
 782                   new DB_find_all_result);
 783          $result = $p->find_by_first_name('Ben');
 784          // Test find_by_first_name_and_last_name()
 785          $p = new PersonName;
 786          Trax::$active_record_connections[TRAX_ENV]->expect_query(
 787                   "SELECT * FROM person_names"
 788                   ." WHERE first_name='Ben' AND last_name='Dover' ",
 789                   new DB_find_all_result);
 790          $result = $p->find_by_first_name_and_last_name('Ben','Dover');
 791          // Test find_all_by_last_name()
 792          $p = new PersonName;
 793          Trax::$active_record_connections[TRAX_ENV]->expect_query(
 794                   "SELECT * FROM person_names WHERE last_name='Dover' ",
 795                   new DB_find_all_result);
 796          $result = $p->find_all_by_last_name('Dover');
 797          // Test find_all_by_first_name_and_last_name()
 798          $p = new PersonName;
 799          Trax::$active_record_connections[TRAX_ENV]->expect_query(
 800                   "SELECT * FROM person_names"
 801                   ." WHERE first_name='Ben' AND last_name='Dover' ",
 802                   new DB_find_all_result);
 803          $result = $p->find_all_by_first_name_and_last_name('Ben','Dover');
 804      }
 805  
 806      /**
 807       *  Test the find_by_sql() method
 808       *  @todo Implement testFind_by_sql()
 809       */
 810      public function testFind_by_sql() {
 811          // Remove the following line when you implement this test.
 812          throw new PHPUnit2_Framework_IncompleteTestError;
 813      }
 814  
 815      /**
 816       *  Test the get_association() method
 817       *  @todo Implement testGet_association()
 818       */
 819      public function testGet_association() {
 820          // Remove the following line when you implement this test.
 821          throw new PHPUnit2_Framework_IncompleteTestError;
 822      }
 823  
 824      /**
 825       *  Test the get_errors() method
 826       *  @todo Implement testGet_errors()
 827       */
 828      public function testGet_errors() {
 829          // Remove the following line when you implement this test.
 830          throw new PHPUnit2_Framework_IncompleteTestError;
 831      }
 832  
 833      /**
 834       *  Test the get_errors_as_string() method
 835       *  @todo Implement testGet_errors_as_string()
 836       */
 837      public function testGet_errors_as_string() {
 838          // Remove the following line when you implement this test.
 839          throw new PHPUnit2_Framework_IncompleteTestError;
 840      }
 841  
 842      /**
 843       *  Test the is_new_record() method
 844       *  @todo Implement testIs_new_record()
 845       */
 846      public function testIs_new_record() {
 847          // Remove the following line when you implement this test.
 848          throw new PHPUnit2_Framework_IncompleteTestError;
 849      }
 850  
 851      /**
 852       *  Test the limit_select() method
 853       *  @todo Implement testLimit_select()
 854       */
 855      public function testLimit_select() {
 856          // Remove the following line when you implement this test.
 857          throw new PHPUnit2_Framework_IncompleteTestError;
 858      }
 859  
 860      /**
 861       *  Test the load() method
 862       *  @todo Implement testLoad()
 863       */
 864      public function testLoad() {
 865          // Remove the following line when you implement this test.
 866          throw new PHPUnit2_Framework_IncompleteTestError;
 867      }
 868  
 869      /**
 870       *  Test the log_query() method
 871       *  @todo Implement testLog_query()
 872       */
 873      public function testLog_query() {
 874          // Remove the following line when you implement this test.
 875          throw new PHPUnit2_Framework_IncompleteTestError;
 876      }
 877  
 878      /**
 879       *  Test the max_all() method
 880       *  @todo Implement testMax_all()
 881       */
 882      public function testMax_all() {
 883          // Remove the following line when you implement this test.
 884          throw new PHPUnit2_Framework_IncompleteTestError;
 885      }
 886  
 887      /**
 888       *  Test the min_all() method
 889       *  @todo Implement testMin_all()
 890       */
 891      public function testMin_all() {
 892          // Remove the following line when you implement this test.
 893          throw new PHPUnit2_Framework_IncompleteTestError;
 894      }
 895  
 896      /**
 897       *  Test the page_list() method
 898       *  @todo Implement testPage_list()
 899       */
 900      public function testPage_list() {
 901          // Remove the following line when you implement this test.
 902          throw new PHPUnit2_Framework_IncompleteTestError;
 903      }
 904  
 905      /**
 906       *  Test the raise() method
 907       *  @todo Implement testRaise()
 908       */
 909      public function testRaise() {
 910          // Remove the following line when you implement this test.
 911          throw new PHPUnit2_Framework_IncompleteTestError;
 912      }
 913  
 914      /**
 915       *  Test the reload() method
 916       *  @todo Implement testReload()
 917       */
 918      public function testReload() {
 919          // Remove the following line when you implement this test.
 920          throw new PHPUnit2_Framework_IncompleteTestError;
 921      }
 922  
 923      /**
 924       *  Test the rollback() method
 925       *  @todo Implement testRollback()
 926       */
 927      public function testRollback() {
 928          // Remove the following line when you implement this test.
 929          throw new PHPUnit2_Framework_IncompleteTestError;
 930      }
 931  
 932      /**
 933       *  Test the save_without_validation() method
 934       *  @todo Implement testSave_without_validation()
 935       */
 936      public function testSave_without_validation() {
 937          // Remove the following line when you implement this test.
 938          throw new PHPUnit2_Framework_IncompleteTestError;
 939      }
 940  
 941      /**
 942       *  Test the send() method
 943       *  @todo Implement testSend()
 944       */
 945      public function testSend() {
 946          // Remove the following line when you implement this test.
 947          throw new PHPUnit2_Framework_IncompleteTestError;
 948      }
 949  
 950      /**
 951       *  Test the set_content_columns() method
 952       *  @todo Implement testSet_content_columns()
 953       */
 954      public function testSet_content_columns() {
 955          // Remove the following line when you implement this test.
 956          throw new PHPUnit2_Framework_IncompleteTestError;
 957      }
 958  
 959      /**
 960       *  Test the set_table_name_using_class_name() method
 961       *  @todo Implement testSet_table_name_using_class_name()
 962       */
 963      public function testSet_table_name_using_class_name() {
 964          // Remove the following line when you implement this test.
 965          throw new PHPUnit2_Framework_IncompleteTestError;
 966      }
 967  
 968      /**
 969       *  Test the sum_all() method
 970       *  @todo Implement testSum_all()
 971       */
 972      public function testSum_all() {
 973          // Remove the following line when you implement this test.
 974          throw new PHPUnit2_Framework_IncompleteTestError;
 975      }
 976  
 977      /**
 978       *  Test the update() method
 979       *  @todo Implement testUpdate()
 980       */
 981      public function testUpdate() {
 982          // Remove the following line when you implement this test.
 983          throw new PHPUnit2_Framework_IncompleteTestError;
 984      }
 985  
 986      /**
 987       *  Test the update_all() method
 988       *  @todo Implement testUpdate_all()
 989       */
 990      public function testUpdate_all() {
 991          // Remove the following line when you implement this test.
 992          throw new PHPUnit2_Framework_IncompleteTestError;
 993      }
 994  
 995      /**
 996       *  Test the valid() method
 997       *  @todo Implement testValid()
 998       */
 999      public function testValid() {
1000          // Remove the following line when you implement this test.
1001          throw new PHPUnit2_Framework_IncompleteTestError;
1002      }
1003  
1004      /**
1005       *  Test the validate() method
1006       *  @todo Implement testValidate()
1007       */
1008      public function testValidate() {
1009          // Remove the following line when you implement this test.
1010          throw new PHPUnit2_Framework_IncompleteTestError;
1011      }
1012  
1013      /**
1014       *  Test the validate_on_create() method
1015       *  @todo Implement testValidate_on_create()
1016       */
1017      public function testValidate_on_create() {
1018          // Remove the following line when you implement this test.
1019          throw new PHPUnit2_Framework_IncompleteTestError;
1020      }
1021  
1022      /**
1023       *  Test the validate_on_update() method
1024       *  @todo Implement testValidate_on_update()
1025       */
1026      public function testValidate_on_update() {
1027          // Remove the following line when you implement this test.
1028          throw new PHPUnit2_Framework_IncompleteTestError;
1029      }
1030  
1031      /**
1032       *  Test the __call() method
1033       *  @todo Implement test__call()
1034       */
1035      public function test__call() {
1036          // Remove the following line when you implement this test.
1037          throw new PHPUnit2_Framework_IncompleteTestError;
1038      }
1039  
1040      /**
1041       *  Test the __get() method
1042       *  @todo Implement test__get()
1043       */
1044      public function test__get() {
1045          // Remove the following line when you implement this test.
1046          throw new PHPUnit2_Framework_IncompleteTestError;
1047      }
1048  
1049      /**
1050       *  Test the __set() method
1051       *  @todo Implement test__set()
1052       */
1053      public function test__set() {
1054          // Remove the following line when you implement this test.
1055          throw new PHPUnit2_Framework_IncompleteTestError;
1056      }
1057  }
1058  
1059  // Call ActiveRecordTest::main() if this source file is executed directly.
1060  if (PHPUnit2_MAIN_METHOD == "ActiveRecordTest::main") {
1061      ActiveRecordTest::main();
1062  }
1063  
1064  // -- set Emacs parameters --
1065  // Local variables:
1066  // tab-width: 4
1067  // c-basic-offset: 4
1068  // c-hanging-comment-ender-p: nil
1069  // indent-tabs-mode: nil
1070  // End:
1071  ?>


Généré le : Sun Feb 25 20:04:38 2007 par Balluche grâce à PHPXref 0.7