From 3038bdc80f7ae1bd7a3f3a5abb0ae5b6207bacd0 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 2 Mar 2014 22:22:41 +0000 Subject: [PATCH] Restore $content_width global value after changing it in test_constrain_size_for_editor_*(). props ericlewis, georgestephanis, salcode, jorbin. fixes #27256. git-svn-id: https://develop.svn.wordpress.org/trunk@27358 602fd350-edb4-49c9-b593-d223f7449a82 --- tests/phpunit/tests/image/size.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/phpunit/tests/image/size.php b/tests/phpunit/tests/image/size.php index 1d0f533c50..c7cb51b8a7 100644 --- a/tests/phpunit/tests/image/size.php +++ b/tests/phpunit/tests/image/size.php @@ -173,6 +173,9 @@ class Tests_Image_Size extends WP_UnitTestCase { function test_constrain_size_for_editor_medium() { // default max width is 500, no constraint on height global $content_width; + + $_content_width = $content_width; + $content_width = 0; update_option('medium_size_w', 500); update_option('medium_size_h', 0); @@ -190,10 +193,15 @@ class Tests_Image_Size extends WP_UnitTestCase { $content_width = 350; $out = image_constrain_size_for_editor(600, 400, 'medium'); $this->assertEquals(array(500, 333), $out); + + $content_width = $_content_width; } function test_constrain_size_for_editor_full() { global $content_width; + + $_content_width = $content_width; + $content_width = 400; $out = image_constrain_size_for_editor(600, 400, 'full'); $this->assertEquals(array(600, 400), $out); @@ -209,6 +217,8 @@ class Tests_Image_Size extends WP_UnitTestCase { $out = image_constrain_size_for_editor(64, 64, 'full'); $this->assertEquals(array(64, 64), $out); + + $content_width = $_content_width; } }