Skip to content

Commit 788ce0b

Browse files
committed
- bump image-comparator version to 1.2;
- added github actions for PRs; - adjusted unit tests
1 parent 1c5974e commit 788ce0b

File tree

4 files changed

+61
-14
lines changed

4 files changed

+61
-14
lines changed

.github/workflows/pr.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Image Comparator Laravel PR pipeline
2+
3+
on:
4+
pull_request:
5+
types:
6+
- assigned
7+
- opened
8+
- reopened
9+
- review_requested
10+
- synchronize
11+
12+
jobs:
13+
phpunit:
14+
runs-on: ubuntu-24.04
15+
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v3
19+
20+
- name: Set up PHP
21+
uses: shivammathur/setup-php@v2
22+
with:
23+
php-version: '8.2'
24+
25+
- name: Install Composer dependencies
26+
run: composer install --prefer-dist --no-progress --no-suggest
27+
28+
- name: Run PHPUnit tests
29+
run: ./vendor/bin/phpunit --testsuite=unit
30+
31+
phpcs:
32+
runs-on: ubuntu-24.04
33+
34+
steps:
35+
- name: Checkout code
36+
uses: actions/checkout@v3
37+
38+
- name: Set up PHP
39+
uses: shivammathur/setup-php@v2
40+
with:
41+
php-version: '8.2'
42+
43+
- name: Install Composer dependencies
44+
run: composer install --prefer-dist --no-progress --no-suggest
45+
46+
- name: Run PHP CodeSniffer
47+
run: ./vendor/bin/phpcs -p .

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"require": {
1515
"php": "^8.1",
16-
"sapientpro/image-comparator": "^1.1.0",
16+
"sapientpro/image-comparator": "^1.2",
1717
"illuminate/support": "^8.0|^9.0|^10.0|^11.0"
1818
},
1919
"autoload": {

composer.lock

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Unit/ComparatorTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function testCompareImages(): void
1616
'tests/images/amazon-image.png'
1717
);
1818

19-
$this->assertSame(87.5, $similarity);
19+
$this->assertSame(86.994, $similarity);
2020

2121
$similarityArray = Comparator::compareArray(
2222
'tests/images/ebay-image.png',
@@ -27,8 +27,8 @@ public function testCompareImages(): void
2727
);
2828

2929
$this->assertSame([
30-
'amazon1' => 87.5,
31-
'amazon2' => 53.1
30+
'amazon1' => 86.994,
31+
'amazon2' => 43.436
3232
], $similarityArray);
3333
}
3434

@@ -39,7 +39,7 @@ public function testDetectSimilarities(): void
3939
'tests/images/amazon-image.png'
4040
);
4141

42-
$this->assertSame(87.5, $similarity);
42+
$this->assertSame(86.994, $similarity);
4343

4444
$similarityArray = Comparator::detectArray(
4545
'tests/images/ebay-image.png',
@@ -50,8 +50,8 @@ public function testDetectSimilarities(): void
5050
);
5151

5252
$this->assertSame([
53-
'amazon1' => 87.5,
54-
'amazon2' => 62.5
53+
'amazon1' => 86.994,
54+
'amazon2' => 48.59
5555
], $similarityArray);
5656
}
5757

0 commit comments

Comments
 (0)