Permalink
Browse files

Updating MediaView test

UPPERCASE extesion test included

Signed-off-by: mark_story <mark@mark-story.com>
  • Loading branch information...
CauanCabral authored and markstory committed May 27, 2011
1 parent 684c377 commit 5fd19266ba22ad0b171ab95da415baaa5eb4edd8
@@ -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);
Binary file not shown.

1 comment on commit 5fd1926

@jimiyash

This comment has been minimized.

Show comment Hide comment
@jimiyash

jimiyash Jul 13, 2011

typo testRenderUpperExtesnion on line 176

typo testRenderUpperExtesnion on line 176

Please sign in to comment.