Changeset 48790
- Timestamp:
- 08/13/2020 12:32:03 PM (4 years ago)
- Location:
- trunk/tests/phpunit
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/includes/plural-form-function.php
r46586 r48790 8 8 */ 9 9 function tests_make_plural_form_function( $nplurals, $expression ) { 10 $expression = str_replace( 'n', '$n', $expression ); 11 $func_body = " 12 \$index = (int)($expression); 13 return (\$index < $nplurals)? \$index : $nplurals - 1;"; 10 $closure = function ( $n ) use ( $nplurals, $expression ) { 11 $expression = str_replace( 'n', $n, $expression ); 14 12 15 // phpcs:ignore WordPress.PHP.RestrictedPHPFunctions.create_function_create_function 16 return create_function( '$n', $func_body ); 13 // phpcs:ignore Squiz.PHP.Eval -- This is test code, not production. 14 $index = (int) eval( 'return ' . $expression . ';' ); 15 16 return ( $index < $nplurals ) ? $index : $nplurals - 1; 17 }; 18 19 return $closure; 17 20 } -
trunk/tests/phpunit/tests/pomo/pluralForms.php
r47198 r48790 75 75 */ 76 76 public function test_regression( $lang, $nplurals, $expression ) { 77 if ( version_compare( phpversion(), '7.2', '>=' ) ) {78 $this->markTestSkipped( 'Lambda functions are deprecated in PHP 7.2' );79 }80 81 77 require_once dirname( dirname( __DIR__ ) ) . '/includes/plural-form-function.php'; 82 78
Note: See TracChangeset
for help on using the changeset viewer.