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

Source for file MissingParameterTest.php

Documentation is available at MissingParameterTest.php

  1. <?php
  2. /**
  3.  * Console Library
  4.  *
  5.  * LICENSE
  6.  *
  7.  * "THE BEER-WARE LICENSE" (Revision 42):
  8.  * "Sven Strittmatter" <ausserirdisch@sven-space.de> wrote this file.
  9.  * As long as you retain this notice you can do whatever you want with
  10.  * this stuff. If we meet some day, and you think this stuff is worth it,
  11.  * you can buy me a beer in return.
  12.  *
  13.  * $Author$
  14.  * $Revisio$
  15.  *
  16.  * @category    Console
  17.  * @package     Unittests
  18.  * @copyright   Copyright (c) 2009 Sven Strittmatter
  19.  */
  20.  
  21. // Call Console_ApplicationTest::main() if this source file is executed directly.
  22. if (!defined('PHPUnit_MAIN_METHOD')) {
  23.     define('PHPUnit_MAIN_METHOD''Console_Exception_MissingParameterTest::main');
  24. }
  25.  
  26. /**
  27.  * Test helper
  28.  */
  29. require_once(dirname(__FILE__'/../../TestHelper.php');
  30.  
  31. /**
  32.  * Console_Application_Abstract
  33.  */
  34. require_once('Console/Exception/MissingParameter.php');
  35.  
  36. /**
  37.  * @category   Console
  38.  * @package    Unittests
  39.  * @subpackage Console_Exception
  40.  * @copyright  Copyright (c) 2009 Sven Strittmatter
  41.  */
  42. class Console_Exception_MissingParameterTest extends PHPUnit_Framework_TestCase {
  43.     /**
  44.      * Runs the test methods of this class.
  45.      *
  46.      * @return void 
  47.      */
  48.     public static function main({
  49.         require_once('PHPUnit/TextUI/TestRunner.php');
  50.         $suite  new PHPUnit_Framework_TestSuite("Console_Exception_MissingParameterTest");
  51.         $result PHPUnit_TextUI_TestRunner::run($suite);
  52.     }
  53.  
  54.     /**
  55.      * We expect a string like:
  56.      * <pre>
  57.      * You omitted the required parameter PARAMETER.
  58.      * </pre>
  59.      */
  60.     public function testTosTring({
  61.         $parmeters array('a''b''f''-blub''LaLa');
  62.  
  63.         foreach ($parmeters as $parameter{
  64.             $expectedString "You omitted the required parameter $parameter.";
  65.             $exception      new Console_Exception_MissingParameter($parameter);
  66.             $this->assertEquals($expectedString$exception->__toString());
  67.             $this->assertEquals($expectedString$exception '');
  68.         }
  69.     }
  70. }
  71.  
  72. // Call Console_ApplicationTest::main() if this source file is executed directly.
  73. if (PHPUnit_MAIN_METHOD === 'Console_Exception_MissingParameterTest::main'{
  74. }

Documentation generated on Mon, 17 Aug 2009 15:52:53 +0200 by phpDocumentor 1.4.2