]> git.mxchange.org Git - shipsimu.git/blobdiff - tests/RequestTest.php
More files found which have been updated
[shipsimu.git] / tests / RequestTest.php
index c4edab05afc9d5a4b8fb0e870e49f814f5299010..d7e86535e9532d9131a936d664e2b263d0cf55f5 100644 (file)
@@ -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 <webmaster@mxchange.org>
+ * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright(c) 2007, 2008 Roland Haeder, this is free software
+ * @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)
+                       ));
+               }
+       }
 }
 
 ?>