[ Index ] |
PHP Cross Reference of YOURLS |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * HTTP misc utilities and helpers 5 * 6 * @since 0.1 7 */ 8 #[\PHPUnit\Framework\Attributes\Group('http')] 9 class MiscTest extends PHPUnit\Framework\TestCase { 10 11 protected function tearDown(): void { 12 yourls_remove_filter( 'http_get_proxy', 'yourls_return_true' ); 13 yourls_remove_filter( 'http_get_proxy', 'yourls_return_false' ); 14 } 15 16 /** 17 * Check that SSL capability check returns a boolean 18 * 19 * @since 0.1 20 */ 21 public function test_can_SSL() { 22 $this->assertTrue( is_bool( yourls_can_http_over_ssl() ) ); 23 } 24 25 /** 26 * Check request default options 27 * 28 * @since 0.1 29 */ 30 public function test_request_default_options() { 31 yourls_add_filter( 'http_get_proxy', 'yourls_return_false' ); 32 $options = yourls_http_default_options(); 33 $this->assertArrayHasKey( 'timeout', $options ); 34 $this->assertArrayHasKey( 'useragent', $options ); 35 $this->assertArrayHasKey( 'follow_redirects', $options ); 36 $this->assertArrayHasKey( 'redirects', $options ); 37 $this->assertArrayNotHasKey( 'proxy', $options ); 38 } 39 40 /** 41 * Check request default options with a proxy 42 * 43 * @since 0.1 44 */ 45 public function test_request_default_options_proxy() { 46 yourls_add_filter( 'http_get_proxy', 'yourls_return_true' ); 47 $options = yourls_http_default_options(); 48 $this->assertArrayHasKey( 'timeout', $options ); 49 $this->assertArrayHasKey( 'useragent', $options ); 50 $this->assertArrayHasKey( 'follow_redirects', $options ); 51 $this->assertArrayHasKey( 'redirects', $options ); 52 $this->assertArrayHasKey( 'proxy', $options ); 53 } 54 55 /** 56 * Check we have a user agent string 57 * 58 * @since 0.1 59 */ 60 public function test_user_agent() { 61 $this->assertTrue( is_string( yourls_http_user_agent() ) ); 62 } 63 64 }
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 |