Skip to content

Commit

Permalink
Merge pull request #2 from pboivin/glide-version
Browse files Browse the repository at this point in the history
fix: Update glide version constraints
  • Loading branch information
pboivin authored Aug 4, 2022
2 parents 84bf11a + a64bea4 commit fd5c735
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 8 deletions.
14 changes: 8 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@ jobs:
fail-fast: false
matrix:
php: ['8.0', '8.1']
glide: ['1.*', '2.*']

name: P${{ matrix.php }}
name: P${{ matrix.php }} G${{ matrix.glide }}

steps:
- uses: actions/checkout@v2

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}

Expand All @@ -30,13 +31,14 @@ jobs:
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-node-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.glide }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-node-
${{ runner.os }}-${{ matrix.php }}-${{ matrix.glide }}-composer-
- name: Install dependencies
if: steps.composer-cache.outputs.cache-hit != 'true'
run: composer install --prefer-dist --no-progress --no-suggest
run: |
composer require "league/glide:${{ matrix.glide }}" --no-interaction --no-update
composer install --prefer-dist --no-interaction --no-plugins
- name: Run test suite
run: php vendor/bin/phpunit
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
*.swp

/__tmp__
/tests/fixtures/__cache__
/vendor
/composer.lock
/.php_cs.cache
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Release Notes

## [v1.0.1](https://github.com/pboivin/flou/compare/v1.0.0...v1.0.1) - 2022-08-04

#### Fixed

- Update glide version constraints to allow installation on a wider range of projects


## [v1.0.0](https://github.com/pboivin/flou/compare/v1.0.0-beta...v1.0.0) - 2022-08-01

#### Added
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
],
"require": {
"php": ">=8.0",
"league/glide": "^2.2"
"league/glide": "^1.0|^2.0"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
Expand Down
51 changes: 51 additions & 0 deletions tests/GlideTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

namespace Pboivin\Flou\Tests;

use PHPUnit\Framework\TestCase;
use Pboivin\Flou\ImageFactory;

class GlideTest extends TestCase
{
protected $factory;
protected $sourcePath;
protected $cachePath;
protected $cachedFile;

protected function setUp(): void
{
$this->sourcePath = __DIR__ . '/fixtures/source';

$this->cachePath = __DIR__ . '/fixtures/__cache__';

$this->factory = new ImageFactory([
'sourcePath' => $this->sourcePath,
'cachePath' => $this->cachePath,
'sourceUrlBase' => '/images/source',
'cacheUrlBase' => '/images/cache',
]);

$this->cleanCacheDirectories();
}

protected function cleanCacheDirectories()
{
if (file_exists($this->cachePath . '/square.jpg')) {
foreach (glob($this->cachePath . '/square.jpg/*') as $file) {
unlink($file);
}

rmdir($this->cachePath . '/square.jpg');
}
}

public function test_can_transform_source_image()
{
$this->assertFalse(file_exists($this->cachePath . '/square.jpg'));

$image = $this->factory->image('square.jpg');

$this->assertTrue(file_exists($this->cachePath . '/square.jpg'));
$this->assertTrue(file_exists($image->cached()->path()));
}
}
2 changes: 1 addition & 1 deletion tests/ImageFileInspectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public function test_can_inspect_size()
{
$inspector = new ImageFileInspector();

$size = $inspector->getSize(__DIR__ . '/fixtures/square.jpg');
$size = $inspector->getSize(__DIR__ . '/fixtures/source/square.jpg');

$this->assertEquals(100, $size['width']);
$this->assertEquals(100, $size['height']);
Expand Down
File renamed without changes

0 comments on commit fd5c735

Please sign in to comment.