Build/Test tools: Remove occurrences of create_function() in unit tests.

Props desrosj

See #37082


git-svn-id: https://develop.svn.wordpress.org/trunk@40392 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
John Blackbourn
2017-04-07 13:37:39 +00:00
parent 4fbac9b3a7
commit 2a261f0d7c
2 changed files with 60 additions and 6 deletions

View File

@@ -45,6 +45,20 @@ class Tests_Image_Editor extends WP_Image_UnitTestCase {
WP_Image_Editor_Mock::$load_return = true;
}
/**
* Return integer of 95 for testing.
*/
public function return_integer_95() {
return 95;
}
/**
* Return integer of 100 for testing.
*/
public function return_integer_100() {
return 100;
}
/**
* Test test_quality
* @ticket 6821
@@ -59,11 +73,11 @@ class Tests_Image_Editor extends WP_Image_UnitTestCase {
$this->assertEquals( 82, $editor->get_quality() );
// Ensure the quality filters do not have precedence if created after editor instantiation.
$func_100_percent = create_function( '', "return 100;" );
$func_100_percent = array( $this, 'return_integer_100' );
add_filter( 'wp_editor_set_quality', $func_100_percent );
$this->assertEquals( 82, $editor->get_quality() );
$func_95_percent = create_function( '', "return 95;" );
$func_95_percent = array( $this, 'return_integer_95' );
add_filter( 'jpeg_quality', $func_95_percent );
$this->assertEquals( 82, $editor->get_quality() );