diff --git a/tests/codeigniter/libraries/Upload_test.php b/tests/codeigniter/libraries/Upload_test.php index 1bc1d85cb40..5db602fc441 100644 --- a/tests/codeigniter/libraries/Upload_test.php +++ b/tests/codeigniter/libraries/Upload_test.php @@ -107,8 +107,9 @@ function test_set_allowed_types() function test_set_image_properties() { + $dir = preg_replace('/^(.*\/tests\/).*$/', '$1', __FILE__); $this->upload->file_type = 'image/gif'; - $this->upload->file_temp = 'mocks/uploads/ci_logo.gif'; + $this->upload->file_temp = $dir.'mocks/uploads/ci_logo.gif'; $props = array( 'image_width' => 170, @@ -157,7 +158,8 @@ function test_is_allowed_filetype() $this->assertTrue($this->upload->is_allowed_filetype(FALSE)); $this->assertTrue($this->upload->is_allowed_filetype(TRUE)); - $this->upload->file_temp = 'mocks/uploads/ci_logo.gif'; + $dir = preg_replace('/^(.*\/tests\/).*$/', '$1', __FILE__); + $this->upload->file_temp = $dir.'mocks/uploads/ci_logo.gif'; $this->upload->file_ext = '.gif'; $this->upload->file_type = 'image/gif'; $this->assertTrue($this->upload->is_allowed_filetype()); @@ -179,8 +181,9 @@ function test_is_allowed_dimensions() $this->upload->file_type = 'text/plain'; $this->assertTrue($this->upload->is_allowed_dimensions()); + $dir = preg_replace('/^(.*\/tests\/).*$/', '$1', __FILE__); $this->upload->file_type = 'image/gif'; - $this->upload->file_temp = 'mocks/uploads/ci_logo.gif'; + $this->upload->file_temp = $dir.'mocks/uploads/ci_logo.gif'; $this->upload->max_width = 10; $this->assertFalse($this->upload->is_allowed_dimensions()); @@ -236,7 +239,8 @@ function test_do_xss_clean() $this->upload->file_temp = vfsStream::url('file3.txt'); $this->assertFalse($this->upload->do_xss_clean()); - $this->upload->file_temp = 'mocks/uploads/ci_logo.gif'; + $dir = preg_replace('/^(.*\/tests\/).*$/', '$1', __FILE__); + $this->upload->file_temp = $dir.'mocks/uploads/ci_logo.gif'; $this->assertTrue($this->upload->do_xss_clean()); }