Skip to content

Commit fd5c735

Browse files
authored
Merge pull request #2 from pboivin/glide-version
fix: Update glide version constraints
2 parents 84bf11a + a64bea4 commit fd5c735

File tree

7 files changed

+69
-8
lines changed

7 files changed

+69
-8
lines changed

.github/workflows/tests.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ jobs:
1414
fail-fast: false
1515
matrix:
1616
php: ['8.0', '8.1']
17+
glide: ['1.*', '2.*']
1718

18-
name: P${{ matrix.php }}
19+
name: P${{ matrix.php }} G${{ matrix.glide }}
1920

2021
steps:
2122
- uses: actions/checkout@v2
2223

2324
- name: Setup PHP, with composer and extensions
24-
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
25+
uses: shivammathur/setup-php@v2
2526
with:
2627
php-version: ${{ matrix.php }}
2728

@@ -30,13 +31,14 @@ jobs:
3031
uses: actions/cache@v2
3132
with:
3233
path: vendor
33-
key: ${{ runner.os }}-node-${{ hashFiles('**/composer.json') }}
34+
key: ${{ runner.os }}-${{ matrix.php }}-${{ matrix.glide }}-composer-${{ hashFiles('**/composer.lock') }}
3435
restore-keys: |
35-
${{ runner.os }}-node-
36+
${{ runner.os }}-${{ matrix.php }}-${{ matrix.glide }}-composer-
3637
3738
- name: Install dependencies
38-
if: steps.composer-cache.outputs.cache-hit != 'true'
39-
run: composer install --prefer-dist --no-progress --no-suggest
39+
run: |
40+
composer require "league/glide:${{ matrix.glide }}" --no-interaction --no-update
41+
composer install --prefer-dist --no-interaction --no-plugins
4042
4143
- name: Run test suite
4244
run: php vendor/bin/phpunit

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
*.swp
33

44
/__tmp__
5+
/tests/fixtures/__cache__
56
/vendor
67
/composer.lock
78
/.php_cs.cache

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Release Notes
22

3+
## [v1.0.1](https://github.com/pboivin/flou/compare/v1.0.0...v1.0.1) - 2022-08-04
4+
5+
#### Fixed
6+
7+
- Update glide version constraints to allow installation on a wider range of projects
8+
9+
310
## [v1.0.0](https://github.com/pboivin/flou/compare/v1.0.0-beta...v1.0.0) - 2022-08-01
411

512
#### Added

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
],
1717
"require": {
1818
"php": ">=8.0",
19-
"league/glide": "^2.2"
19+
"league/glide": "^1.0|^2.0"
2020
},
2121
"require-dev": {
2222
"phpunit/phpunit": "^9.5",

tests/GlideTest.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
namespace Pboivin\Flou\Tests;
4+
5+
use PHPUnit\Framework\TestCase;
6+
use Pboivin\Flou\ImageFactory;
7+
8+
class GlideTest extends TestCase
9+
{
10+
protected $factory;
11+
protected $sourcePath;
12+
protected $cachePath;
13+
protected $cachedFile;
14+
15+
protected function setUp(): void
16+
{
17+
$this->sourcePath = __DIR__ . '/fixtures/source';
18+
19+
$this->cachePath = __DIR__ . '/fixtures/__cache__';
20+
21+
$this->factory = new ImageFactory([
22+
'sourcePath' => $this->sourcePath,
23+
'cachePath' => $this->cachePath,
24+
'sourceUrlBase' => '/images/source',
25+
'cacheUrlBase' => '/images/cache',
26+
]);
27+
28+
$this->cleanCacheDirectories();
29+
}
30+
31+
protected function cleanCacheDirectories()
32+
{
33+
if (file_exists($this->cachePath . '/square.jpg')) {
34+
foreach (glob($this->cachePath . '/square.jpg/*') as $file) {
35+
unlink($file);
36+
}
37+
38+
rmdir($this->cachePath . '/square.jpg');
39+
}
40+
}
41+
42+
public function test_can_transform_source_image()
43+
{
44+
$this->assertFalse(file_exists($this->cachePath . '/square.jpg'));
45+
46+
$image = $this->factory->image('square.jpg');
47+
48+
$this->assertTrue(file_exists($this->cachePath . '/square.jpg'));
49+
$this->assertTrue(file_exists($image->cached()->path()));
50+
}
51+
}

tests/ImageFileInspectorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public function test_can_inspect_size()
1414
{
1515
$inspector = new ImageFileInspector();
1616

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

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

0 commit comments

Comments
 (0)