Skip to content

Commit

Permalink
Make Uploader test work on local machine and Travis
Browse files Browse the repository at this point in the history
Signed-off-by: dchill42 <dchill42@gmail.com>
  • Loading branch information
dchill42 committed Sep 24, 2012
1 parent 155020b commit 1cebce9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/codeigniter/libraries/Upload_test.php
Expand Up @@ -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,
Expand Down Expand Up @@ -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());
Expand All @@ -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());
Expand Down Expand Up @@ -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());
}

Expand Down

0 comments on commit 1cebce9

Please sign in to comment.