1 | <?php |
||
6 | class RequestTest extends \PHPUnit_Framework_TestCase { |
||
7 | protected $request; |
||
8 | protected $server = [ |
||
9 | 'SERVER_PROTOCOL' => '1.0', |
||
10 | 'REQUEST_METHOD' => 'GET', |
||
11 | 'REQUEST_URI' => '/index.php', |
||
12 | 'REQUEST_URI_PATH' => '/index.php', |
||
13 | 'HTTPS' => FALSE, |
||
14 | 'HTTP_MY_HEADER' => 'my value' |
||
15 | ]; |
||
16 | |||
17 | protected $get = [ |
||
18 | 'name' => 'nascho' |
||
19 | ]; |
||
20 | |||
21 | // set up value for global scope |
||
22 | public function setup(){ |
||
27 | |||
28 | // check if HTTP method is get |
||
29 | public function testHttpRequestMethodIsGet(){ |
||
32 | |||
33 | // check if HTTP method is POST |
||
34 | public function testHttpRequestMethodIsPost(){ |
||
37 | |||
38 | // check if HTTP method is PUT |
||
39 | public function testHttpRequestMethodIsPut(){ |
||
42 | |||
43 | // check if HTTP method is delete |
||
44 | public function testHttpRequestMethodIsDelete(){ |
||
47 | |||
48 | // check if GET value is same as assigned |
||
49 | public function testGetVariableFromGetRequest(){ |
||
52 | |||
53 | // test that POST value is null |
||
54 | // request method is GET only for this example |
||
55 | public function testPostVariableFromPostRequest(){ |
||
58 | |||
59 | // test server protocol returns the correct version |
||
60 | public function testServerProtocolReturnsResult(){ |
||
63 | |||
64 | // test reques URI is same as assigned |
||
65 | public function testRequestUriReturnsResult(){ |
||
68 | |||
69 | // http referer is not declared, so check this test returns null |
||
70 | public function testServerRefererReturnsNull(){ |
||
73 | |||
74 | // check request type returns GET method. |
||
75 | public function testGetMethodReturnsRequestMethodResult(){ |
||
78 | |||
79 | // test if connection is authenticated / HTTPS |
||
80 | public function testConnectionIsViaHTTPS(){ |
||
83 | |||
84 | // assert false that this is an AJAX request. |
||
85 | public function testRequestMethodHasNoHxrObject(){ |
||
88 | |||
89 | } |