[ Index ] |
PHP Cross Reference of YOURLS |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * HTTP redirects and headers 5 * 6 * @group http 7 */ 8 class HTTP_Headers_Tests extends PHPUnit\Framework\TestCase { 9 10 public function todo_some_day_test_redirect() { 11 // PHP headers are a bitch to test. TODO some day. 12 } 13 14 /** 15 * Test that we have some javascript redirection output 16 */ 17 public function test_javascript_redirect() { 18 $regexp = '!<script type="text/javascript">\s*window.location="http://somewhere";!m'; 19 20 $this->expectOutputRegex($regexp); 21 yourls_redirect_javascript('http://somewhere'); 22 } 23 24 public function status_codes() { 25 return array( 26 array(100, 'Continue'), 27 array(101, 'Switching Protocols'), 28 array(102, 'Processing'), 29 30 array(200, 'OK'), 31 array(201, 'Created'), 32 array(202, 'Accepted'), 33 array(203, 'Non-Authoritative Information'), 34 array(204, 'No Content'), 35 array(205, 'Reset Content'), 36 array(206, 'Partial Content'), 37 array(207, 'Multi-Status'), 38 array(226, 'IM Used'), 39 40 array(300, 'Multiple Choices'), 41 array(301, 'Moved Permanently'), 42 array(302, 'Found'), 43 array(303, 'See Other'), 44 array(304, 'Not Modified'), 45 array(305, 'Use Proxy'), 46 array(306, 'Reserved'), 47 array(307, 'Temporary Redirect'), 48 49 array(400, 'Bad Request'), 50 array(401, 'Unauthorized'), 51 array(402, 'Payment Required'), 52 array(403, 'Forbidden'), 53 array(404, 'Not Found'), 54 array(405, 'Method Not Allowed'), 55 array(406, 'Not Acceptable'), 56 array(407, 'Proxy Authentication Required'), 57 array(408, 'Request Timeout'), 58 array(409, 'Conflict'), 59 array(410, 'Gone'), 60 array(411, 'Length Required'), 61 array(412, 'Precondition Failed'), 62 array(413, 'Request Entity Too Large'), 63 array(414, 'Request-URI Too Long'), 64 array(415, 'Unsupported Media Type'), 65 array(416, 'Requested Range Not Satisfiable'), 66 array(417, 'Expectation Failed'), 67 array(422, 'Unprocessable Entity'), 68 array(423, 'Locked'), 69 array(424, 'Failed Dependency'), 70 array(426, 'Upgrade Required'), 71 72 array(500, 'Internal Server Error'), 73 array(501, 'Not Implemented'), 74 array(502, 'Bad Gateway'), 75 array(503, 'Service Unavailable'), 76 array(504, 'Gateway Timeout'), 77 array(505, 'HTTP Version Not Supported'), 78 array(506, 'Variant Also Negotiates'), 79 array(507, 'Insufficient Storage'), 80 array(510, 'Not Extended'), 81 ); 82 } 83 84 /** 85 * @dataProvider status_codes 86 */ 87 public function test_get_HTTP_status($code, $status) { 88 $this->assertSame(yourls_get_HTTP_status($code), $status); 89 } 90 91 public function test_get_HTTP_status_invalid() { 92 $this->assertSame(yourls_get_HTTP_status(1337), ''); 93 } 94 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Mon Mar 3 05:10:02 2025 | Cross-referenced by PHPXref 0.7.1 |