From 56106630e172203858d58325dea5d2e81b226f87 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Thu, 21 Apr 2011 13:10:19 -0500 Subject: load->file() tests. --- tests/codeigniter/core/Loader_test.php | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'tests/codeigniter') 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'); } -- cgit v1.2.3-24-g4f1b