Skip to content

Commit

Permalink
Merge pull request #79 from jdecool/test-factory-http
Browse files Browse the repository at this point in the history
Unit test for issue #78
  • Loading branch information
jdecool committed Jul 5, 2015
2 parents 56d364a + ba855e7 commit 0174210
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ matrix:
- php: 7.0

before_script:
- php -S localhost:8000 -t fixtures/ &> /dev/null &
- composer self-update
- composer install --prefer-source

Expand Down
Binary file added fixtures/sample1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 11 additions & 1 deletion tests/ImageWorkshopTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class ImageWorkshopTest extends \PHPUnit_Framework_TestCase
// ===================================================================================

const IMAGE_SAMPLE_PATH = '/Resources/images/sample1.jpg';
const FONT_SAMPLE_PATH = '/Resources/fonts/arial.ttf';
const FONT_SAMPLE_PATH = '/Resources/fonts/arial.ttf';
const WEB_PATH = 'http://localhost:8000';

// Tests
// ===================================================================================
Expand All @@ -46,6 +47,15 @@ public function testInitFromPath()
$this->assertTrue(get_class($layer) === 'PHPImageWorkshop\Core\ImageWorkshopLayer', 'Expect $layer to be an ImageWorkshopLayer object');

// test 3

if (version_compare(PHP_VERSION, '5.4', '>=')) {
$layer = ImageWorkshop::initFromPath(static::WEB_PATH.'/sample1.jpg');

$this->assertTrue(is_object($layer) === true, 'Expect $layer to be an object');
$this->assertTrue(get_class($layer) === 'PHPImageWorkshop\Core\ImageWorkshopLayer', 'Expect $layer to be an ImageWorkshopLayer object');
}

// test 4

$this->setExpectedException('PHPImageWorkshop\Exception\ImageWorkshopException', '', ImageWorkshop::ERROR_IMAGE_NOT_FOUND);
$layer = ImageWorkshop::initFromPath('fakePath');
Expand Down

0 comments on commit 0174210

Please sign in to comment.