diff options
author | Christian Mohr <christian.mohr@insitu.de> | 2018-03-07 19:11:49 +0100 |
---|---|---|
committer | Christian Mohr <christian.mohr@insitu.de> | 2018-03-07 19:11:49 +0100 |
commit | 0e594f14d34e54fa97cb29a0b08eb3efd0e7a939 (patch) | |
tree | d2ea6f38be432eda56e95796a78090cdf5627773 /tests | |
parent | 6b7fc8fc1826406d5c6d04afe2c39a36e5522609 (diff) |
added load_view unit test to ensure that a once set and later missing parameter is in fact missing
Diffstat (limited to 'tests')
-rw-r--r-- | tests/codeigniter/core/Loader_test.php | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/codeigniter/core/Loader_test.php b/tests/codeigniter/core/Loader_test.php index f043d1fcc..40d310274 100644 --- a/tests/codeigniter/core/Loader_test.php +++ b/tests/codeigniter/core/Loader_test.php @@ -303,12 +303,16 @@ class Loader_test extends CI_TestCase { $var = 'hello'; $value = 'World!'; $content = 'This is my test page. '; - $this->ci_vfs_create($view, $content.'<?php echo $'.$var.';', $this->ci_app_root, 'views'); + $this->ci_vfs_create($view, $content.'<?php echo (isset($'.$var.') ? $'.$var.' : "undefined");', $this->ci_app_root, 'views'); // Test returning view $out = $this->load->view($view, array($var => $value), TRUE); $this->assertEquals($content.$value, $out); + // Test view with missing parameter in $vars + $out = $this->load->view($view, [], TRUE); + $this->assertEquals($content.'undefined', $out); + // Mock output class $output = $this->getMockBuilder('CI_Output')->setMethods(array('append_output'))->getMock(); $output->expects($this->once())->method('append_output')->with($content.$value); |