-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from rokka-io/stan-with-just-ffi
Adjust to jcupitt/vips 2.1, test with and without ffi / vips-ext extensions, add some basic phpunit tests
- Loading branch information
Showing
11 changed files
with
190 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Tests with ffi only (no vips-ext) | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
tests: | ||
name: ${{ matrix.php }} ${{ matrix.env.COMPOSER_FLAGS }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- php: '7.4' | ||
- php: '8.0' | ||
env: | ||
COMPOSER_FLAGS: "--prefer-lowest" | ||
- php: '8.0' | ||
- php: '8.1' | ||
|
||
env: | ||
COMPOSER_FLAGS: ${{ matrix.env.COMPOSER_FLAGS }} | ||
steps: | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
tools: composer:v2 | ||
coverage: none | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install vips | ||
run: sudo apt-get install -y libvips | ||
|
||
- name: Install composer dependencies | ||
run: | | ||
composer update --prefer-dist --no-interaction --no-progress --no-ansi ${COMPOSER_FLAGS} | ||
- name: PHPStan | ||
run: composer phpstan | ||
|
||
- name: PHPUnit | ||
run: composer phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Tests with vips-ext and ffi | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
tests: | ||
name: ${{ matrix.php }} ${{ matrix.env.COMPOSER_FLAGS }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- php: '7.2' #even though there's no ffi for 7.2, we leave it here for the "complete" coverage | ||
- php: '7.3' #even though there's no ffi for 7.3, we leave it here for the "complete" coverage | ||
- php: '7.4' | ||
- php: '8.0' | ||
env: | ||
COMPOSER_FLAGS: "--prefer-lowest" | ||
- php: '8.0' | ||
- php: '8.1' | ||
env: | ||
COMPOSER_FLAGS: ${{ matrix.env.COMPOSER_FLAGS }} | ||
steps: | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
tools: composer:v2 | ||
coverage: none | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install vips | ||
run: sudo apt-get install -y libvips-dev | ||
|
||
- name: Install vips extension | ||
run: sudo pecl install vips | ||
|
||
- name: Install vips ext config | ||
run: echo "extension=vips.so" >> $(php -i | grep /.+/php.ini -oE) | ||
|
||
- name: Install composer dependencies | ||
run: | | ||
composer update --prefer-dist --no-interaction --no-progress --no-ansi ${COMPOSER_FLAGS} | ||
- name: PHPStan | ||
run: composer phpstan | ||
|
||
- name: PHPUnit | ||
run: composer phpunit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php declare(strict_types=1); | ||
|
||
use Imagine\Image\Box; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
final class BasicImageTest extends TestCase | ||
{ | ||
|
||
public function testIsVipsEnabled() { | ||
$imagine = new \Imagine\Vips\Imagine(); | ||
$image = $imagine->create(new Box(10,10)); | ||
$this->assertInstanceOf(\Imagine\Vips\Image::class, $image); | ||
$this->assertEquals($image->getSize()->getWidth(), 10); | ||
} | ||
|
||
public function testResizeImage() { | ||
$imagine = new \Imagine\Vips\Imagine(); | ||
$image = $imagine->create(new Box(200,100)); | ||
$image->resize(new Box(50,50)); | ||
$this->assertEquals($image->getSize()->getWidth(), 50); | ||
$this->assertEquals($image->getSize()->getHeight(), 50); | ||
} | ||
|
||
public function testSaveImage() { | ||
$imagine = new \Imagine\Vips\Imagine(); | ||
$image = $imagine->create(new Box(200,100)); | ||
$image->save("foo.jpg"); | ||
$this->assertFileExists("foo.jpg"); | ||
$loaded = $imagine->open("foo.jpg"); | ||
$this->assertEquals($loaded->getSize()->getWidth(), 200); | ||
$this->assertEquals($loaded->getSize()->getHeight(), 100); | ||
unlink("foo.jpg"); | ||
} | ||
} |
Oops, something went wrong.