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