Skip to content
Browse files

Updating MediaView test

UPPERCASE extesion test included

Signed-off-by: mark_story <mark@mark-story.com>
  • Loading branch information...
1 parent 684c377 commit 5fd19266ba22ad0b171ab95da415baaa5eb4edd8 @CauanCabral CauanCabral committed with markstory
View
28 cake/tests/cases/libs/view/media.test.php
@@ -54,6 +54,13 @@ function download() {
$extension = 'css';
$this->set(compact('path', 'id', 'extension'));
}
+
+ function downloadUpper() {
+ $path = TEST_CAKE_CORE_INCLUDE_PATH . 'tests' . DS . 'test_app' . DS . 'vendors' . DS .'img' . DS;
+ $id = 'test_2.JPG';
+ $extension = 'JPG';
+ $this->set(compact('path', 'id', 'extension'));
+ }
}
/**
@@ -134,8 +141,6 @@ function startTest() {
$this->Controller =& new Controller();
$this->MediaController =& new MediaController();
$this->MediaController->viewPath = 'posts';
- $this->MediaController->download();
- $this->MediaView =& new TestMediaView($this->MediaController);
}
/**
@@ -159,12 +164,29 @@ function endTest() {
*/
function testRender() {
ob_start();
+ $this->MediaController->download();
+ $this->MediaView =& new TestMediaView($this->MediaController);
$result = $this->MediaView->render();
$output = ob_get_clean();
$this->assertTrue($result !== false);
$this->assertEqual($output, 'this is the test asset css file');
}
+
+ function testRenderUpperExtesnion() {
+ ob_start();
+ $this->MediaController->downloadUpper();
+ $this->MediaView =& new TestMediaView($this->MediaController);
+ $result = $this->MediaView->render();
+ $output = ob_get_clean();
+
+ $this->assertTrue($result !== false);
+
+ $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));
+ }
/**
* testConnectionAborted method
@@ -173,6 +195,8 @@ function testRender() {
* @return void
*/
function testConnectionAborted() {
+ $this->MediaController->download();
+ $this->MediaView =& new TestMediaView($this->MediaController);
$this->MediaView->active = false;
$result = $this->MediaView->render();
$this->assertFalse($result);
View
BIN cake/tests/test_app/vendors/img/test_2.JPG
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

1 comment on commit 5fd1926

@jimiyash

typo testRenderUpperExtesnion on line 176

Please sign in to comment.
Something went wrong with that request. Please try again.