Changeset 51968 for trunk/tests/phpunit/tests/formatting/wpRelUgc.php
- Timestamp:
- 11/01/2021 10:22:49 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/formatting/wpRelUgc.php
r51623 r51968 10 10 */ 11 11 public function test_add_ugc() { 12 if ( PHP_VERSION_ID >= 80100 ) { 13 /* 14 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 15 * via hooked in filter functions until a more structural solution to the 16 * "missing input validation" conundrum has been architected and implemented. 17 */ 18 $this->expectDeprecation(); 19 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 20 } 21 12 22 $content = '<p>This is some cool <a href="/">Code</a></p>'; 13 23 $expected = '<p>This is some cool <a href=\"/\" rel=\"nofollow ugc\">Code</a></p>'; … … 19 29 */ 20 30 public function test_convert_ugc() { 31 if ( PHP_VERSION_ID >= 80100 ) { 32 /* 33 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 34 * via hooked in filter functions until a more structural solution to the 35 * "missing input validation" conundrum has been architected and implemented. 36 */ 37 $this->expectDeprecation(); 38 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 39 } 40 21 41 $content = '<p>This is some cool <a href="/" rel="weird">Code</a></p>'; 22 42 $expected = '<p>This is some cool <a href=\"/\" rel=\"weird nofollow ugc\">Code</a></p>'; … … 28 48 * @dataProvider data_wp_rel_ugc 29 49 */ 30 public function test_wp_rel_ugc( $input, $output ) { 31 return $this->assertSame( wp_slash( $output ), wp_rel_ugc( $input ) ); 50 public function test_wp_rel_ugc( $input, $output, $expect_deprecation = false ) { 51 if ( true === $expect_deprecation && PHP_VERSION_ID >= 80100 ) { 52 /* 53 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 54 * via hooked in filter functions until a more structural solution to the 55 * "missing input validation" conundrum has been architected and implemented. 56 */ 57 $this->expectDeprecation(); 58 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 59 } 60 61 $this->assertSame( wp_slash( $output ), wp_rel_ugc( $input ) ); 32 62 } 33 63 … … 40 70 '<a href="">Double Quotes</a>', 41 71 '<a href="" rel="nofollow ugc">Double Quotes</a>', 72 true, 42 73 ), 43 74 array( … … 77 108 78 109 public function test_append_ugc_with_valueless_attribute() { 110 if ( PHP_VERSION_ID >= 80100 ) { 111 /* 112 * For the time being, ignoring PHP 8.1 "null to non-nullable" deprecations coming in 113 * via hooked in filter functions until a more structural solution to the 114 * "missing input validation" conundrum has been architected and implemented. 115 */ 116 $this->expectDeprecation(); 117 $this->expectDeprecationMessageMatches( '`Passing null to parameter \#[0-9]+ \(\$[^\)]+\) of type [^ ]+ is deprecated`' ); 118 } 119 79 120 $content = '<p>This is some cool <a href="demo.com" download rel="hola">Code</a></p>'; 80 121 $expected = '<p>This is some cool <a href=\"demo.com\" download rel=\"hola nofollow ugc\">Code</a></p>';
Note: See TracChangeset
for help on using the changeset viewer.