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

Source for file ActiveRecordErrorTest.php

Documentation is available at ActiveRecordErrorTest.php

  1. <?php
  2. /**
  3.  *  File for the ActiveRecordErrorTest 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: ActiveRecordErrorTest.php 192 2006-03-27 22:02:53Z haas $
  11.  * @author Walt Haas <haas@xmission.com>
  12.  */
  13.  
  14. echo "testing ActiveRecordError\n";
  15. require_once 'testenv.php';
  16.  
  17. // Call ActiveRecordErrorTest::main() if this source file is executed directly.
  18. if (!defined("PHPUnit2_MAIN_METHOD")) {
  19.     define("PHPUnit2_MAIN_METHOD""ActiveRecordErrorTest::main");
  20. }
  21.  
  22. require_once "PHPUnit2/Framework/TestCase.php";
  23. require_once "PHPUnit2/Framework/TestSuite.php";
  24.  
  25. // You may remove the following line when all tests have been implemented.
  26. require_once "PHPUnit2/Framework/IncompleteTestError.php";
  27.  
  28. require_once "trax_exceptions.php";
  29.  
  30. /**
  31.  * Test class for ActiveRecordError.
  32.  * Generated by PHPUnit2_Util_Skeleton on 2006-03-01 at 13:17:40.
  33.  */
  34. class ActiveRecordErrorTest extends PHPUnit2_Framework_TestCase {
  35.     /**
  36.      * Runs the test methods of this class.
  37.      *
  38.      * @access public
  39.      * @static
  40.      */
  41.     public static function main({
  42.         require_once "PHPUnit2/TextUI/TestRunner.php";
  43.  
  44.         $suite  new PHPUnit2_Framework_TestSuite("ActiveRecordErrorTest");
  45.         $result PHPUnit2_TextUI_TestRunner::run($suite);
  46.     }
  47.  
  48.     /**
  49.      * Sets up the fixture, for example, open a network connection.
  50.      * This method is called before a test is executed.
  51.      *
  52.      * @access protected
  53.      */
  54.     protected function setUp({
  55.     }
  56.  
  57.     /**
  58.      * Tears down the fixture, for example, close a network connection.
  59.      * This method is called after a test is executed.
  60.      *
  61.      * @access protected
  62.      */
  63.     protected function tearDown({
  64.     }
  65.  
  66.  
  67.     /**
  68.      *  Test exception with default value of code
  69.      */
  70.     public function testDefault_code({
  71.         try {
  72.             throw new ActiveRecordError('text1','text2');
  73.         }
  74.         catch(Exception $e{
  75.             $this->assertTrue(is_a($e,'ActiveRecordError'));
  76.             $this->assertEquals('text1',$e->getMessage());
  77.             $this->assertEquals('text1',$e->error_message);
  78.             $this->assertEquals('text2',$e->error_heading);
  79.             $this->assertEquals('500',$e->error_code);
  80.             return;
  81.         }
  82.         $this->fail('ActiveRecordErrorError exception with default code not raised');
  83.     }
  84.  
  85.     /**
  86.      *  Test exception with specified of code
  87.      */
  88.     public function testSpecified_code({
  89.         try {
  90.             throw new ActiveRecordError('text3','text4'250);
  91.         }
  92.         catch(Exception $e{
  93.             $this->assertTrue(is_a($e,'ActiveRecordError'));
  94.             $this->assertEquals('text3',$e->getMessage());
  95.             $this->assertEquals('text3',$e->error_message);
  96.             $this->assertEquals('text4',$e->error_heading);
  97.             $this->assertEquals(250,$e->error_code);
  98.             return;
  99.         }
  100.         $this->fail('ActiveRecordErrorError exception with code 250 not raised');
  101.     }
  102.  
  103. }
  104.  
  105. // Call ActiveRecordErrorTest::main() if this source file is executed directly.
  106. if (PHPUnit2_MAIN_METHOD == "ActiveRecordErrorTest::main"{
  107. }
  108.  
  109. // -- set Emacs parameters --
  110. // Local variables:
  111. // tab-width: 4
  112. // c-basic-offset: 4
  113. // c-hanging-comment-ender-p: nil
  114. // indent-tabs-mode: nil
  115. // End:
  116. ?>

Documentation generated on Mon, 21 May 2007 22:27:53 -0600 by phpDocumentor 1.3.2