diff options
author | Greg Aker <greg.aker@ellislab.com> | 2011-04-21 20:10:19 +0200 |
---|---|---|
committer | Greg Aker <greg.aker@ellislab.com> | 2011-04-21 20:10:19 +0200 |
commit | 56106630e172203858d58325dea5d2e81b226f87 (patch) | |
tree | 7161664dde6e8cc435931ce45308fb85e519a2df /tests | |
parent | 2febbef34d6427a176e16d5ca69c9f23ffee6b0e (diff) |
load->file() tests.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/codeigniter/core/Loader_test.php | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/tests/codeigniter/core/Loader_test.php b/tests/codeigniter/core/Loader_test.php index 55ab9a4e5..49679e241 100644 --- a/tests/codeigniter/core/Loader_test.php +++ b/tests/codeigniter/core/Loader_test.php @@ -101,7 +101,6 @@ class Loader_test extends CI_TestCase { // -------------------------------------------------------------------- - public function testNonExistentModel() { $this->setExpectedException( @@ -182,8 +181,22 @@ class Loader_test extends CI_TestCase { public function testFile() { - // I'm not entirely sure this is the proper way to handle this. - // $this->load->file('foo'); + $content = 'Here is a test file, which we will load now.'; + $file = vfsStream::newFile('ci_test_mock_file.php')->withContent($content) + ->at($this->load->views_dir); + + // Just like load->view(), take the output class out of the mix here. + $load = $this->load->file(vfsStream::url('application').'/views/ci_test_mock_file.php', + TRUE); + + $this->assertEquals($content, $load); + + $this->setExpectedException( + 'Exception', + 'CI Error: Unable to load the requested file: ci_test_file_not_exists' + ); + + $this->load->file('ci_test_file_not_exists', TRUE); } @@ -210,7 +223,6 @@ class Loader_test extends CI_TestCase { 'CI Error: Unable to load the requested file: helpers/bad_helper.php' ); - $this->load->helper('bad'); } |