X-Git-Url: https://git.mxchange.org/?p=shipsimu.git;a=blobdiff_plain;f=tests%2FRequestTest.php;h=a257260109e944e925d31ab0ccc3c9e7ebea5ccc;hp=c4edab05afc9d5a4b8fb0e870e49f814f5299010;hb=b3e47fb693fb8d40868158b0192b3392b309d97a;hpb=5c330761b4a745bd7bd490ff7585c89d0223a278 diff --git a/tests/RequestTest.php b/tests/RequestTest.php index c4edab0..a257260 100644 --- a/tests/RequestTest.php +++ b/tests/RequestTest.php @@ -28,11 +28,11 @@ print (basename(__FILE__).": Init completed.\n\n"); * A test case for faked HTTP requests. This is faked because we *set* * $_REQUEST here. This should be made better in PHP6... :( * - * @author Roland Haeder + * @author Roland Haeder * @version 0.0.0 * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version - * @link http://www.ship-simu.org + * @link http://www.ship-simu.org * @see http://www.phpunit.de * * This program is free software: you can redistribute it and/or modify @@ -71,6 +71,32 @@ class RequestTest extends PHPUnit_Framework_TestCase { )); } } + + /** + * Now fake a request array and try the test on it again + * + * @return void + */ + public function testFakeRequestElement () { + // Fake the request here + $_REQUEST = array('test_key' => "test_value"); + + // Again get an instance + $requestInstance = HttpRequest::createHttpRequest(); + + // Get the element + $testValue = $requestInstance->getRequestElement('test_key'); + + // Is it the same? + if ($testValue !== "test_value") { + // Something went wrong + $this->fail(sprintf("[%s] Unexpected value %s (%s) from test key received.", + $requestInstance->__toString(), + $testValue, + gettype($testValue) + )); + } + } } ?>