diff --git a/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php b/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php index 05f0171dc3a..e6c988af72c 100644 --- a/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php @@ -519,8 +519,8 @@ public function testDeleteRemovesChildren() { * @return void */ function testDeleteChildrenNotExist() { - $this->assertNull($this->Controller->Cookie->delete('NotFound')); - $this->assertNull($this->Controller->Cookie->delete('Not.Found')); + $this->assertNull($this->Cookie->delete('NotFound')); + $this->assertNull($this->Cookie->delete('Not.Found')); } /** diff --git a/lib/Cake/Test/Case/View/MediaViewTest.php b/lib/Cake/Test/Case/View/MediaViewTest.php index 9e299d1812e..fa49cd79220 100644 --- a/lib/Cake/Test/Case/View/MediaViewTest.php +++ b/lib/Cake/Test/Case/View/MediaViewTest.php @@ -370,11 +370,16 @@ function testRenderUpperExtesnion() { 'extension' => 'JPG', ); - $result = $this->MediaView->render(); + $this->MediaView->response->expects($this->any()) + ->method('type') + ->with('jpg') + ->will($this->returnArgument(0)); - $fileName = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'vendors' . DS .'img' . DS . 'test_2.JPG'; - $file = file_get_contents($fileName, 'r'); - $this->assertEqual(base64_encode($output), base64_encode($file)); + $this->MediaView->expects($this->at(0)) + ->method('_isActive') + ->will($this->returnValue(true)); + + $this->MediaView->render(); } } diff --git a/lib/Cake/Utility/Validation.php b/lib/Cake/Utility/Validation.php index 2872d3f6812..abdb7d18c3b 100644 --- a/lib/Cake/Utility/Validation.php +++ b/lib/Cake/Utility/Validation.php @@ -18,6 +18,10 @@ */ App::uses('Multibyte', 'I18n'); +// Load multibyte if the extension is missing. +if (!function_exists('mb_strlen')) { + class_exists('Multibyte'); +} /** * Offers different validation methods. diff --git a/lib/Cake/View/Helper/TextHelper.php b/lib/Cake/View/Helper/TextHelper.php index c5f5fa8d206..4b7f0540830 100644 --- a/lib/Cake/View/Helper/TextHelper.php +++ b/lib/Cake/View/Helper/TextHelper.php @@ -224,6 +224,10 @@ public function truncate($text, $length = 100, $options = array()) { $options = array_merge($default, $options); extract($options); + if (!function_exists('mb_strlen')) { + class_exists('Multibyte'); + } + if ($html) { if (mb_strlen(preg_replace('/<.*?>/', '', $text)) <= $length) { return $text;