Hamza Bhatti | 756516d | 2012-03-12 09:47:34 +0400 | [diff] [blame] | 1 | <?php |
| 2 | |
| 3 | require BASEPATH . 'helpers/path_helper.php'; |
| 4 | |
| 5 | class Path_helper_test extends CI_TestCase |
| 6 | { |
| 7 | public function test_set_realpath() |
| 8 | { |
Hamza Bhatti | 3ec336f | 2012-03-14 13:50:23 +0400 | [diff] [blame] | 9 | $expected = getcwd() . DIRECTORY_SEPARATOR; |
Hamza Bhatti | 756516d | 2012-03-12 09:47:34 +0400 | [diff] [blame] | 10 | $this->assertEquals($expected, set_realpath(getcwd())); |
| 11 | } |
| 12 | |
| 13 | public function test_set_realpath_nonexistent_directory() |
| 14 | { |
| 15 | $expected = '/path/to/nowhere'; |
| 16 | $this->assertEquals($expected, set_realpath('/path/to/nowhere', FALSE)); |
| 17 | } |
| 18 | |
| 19 | public function test_set_realpath_error_trigger() |
| 20 | { |
| 21 | $this->setExpectedException( |
| 22 | 'RuntimeException', 'CI Error: Not a valid path: /path/to/nowhere' |
| 23 | ); |
| 24 | |
| 25 | set_realpath('/path/to/nowhere', TRUE); |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | /* End of file path_helper_test.php */ |