forked from bcit-ci/CodeIgniter
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(an improved version of PR bcit-ci#645) Also fixed get_content_type() to only return the MIME value and created Output library unit tests for both of these methods.
- Loading branch information
Showing
4 changed files
with
96 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
class Output_test extends CI_TestCase { | ||
|
||
public function set_up() | ||
{ | ||
$this->ci_set_config('charset', 'UTF-8'); | ||
$output = $this->ci_core_class('output'); | ||
$this->output = new $output(); | ||
} | ||
|
||
// -------------------------------------------------------------------- | ||
|
||
public function test_get_content_type() | ||
{ | ||
$this->assertEquals('text/html', $this->output->get_content_type()); | ||
} | ||
|
||
// -------------------------------------------------------------------- | ||
|
||
public function test_get_header() | ||
{ | ||
$this->assertNull($this->output->get_header('Non-Existent-Header')); | ||
|
||
// TODO: Find a way to test header() values as well. Currently, | ||
// PHPUnit prevents this by not using output buffering. | ||
|
||
$this->output->set_content_type('text/plain', 'WINDOWS-1251'); | ||
$this->assertEquals( | ||
'text/plain; charset=windows-1251', // Character set is converted to lowercase | ||
$this->output->get_header('content-type') // Case-insensitive comparison | ||
); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters