Skip to content

Commit 442f9e6

Browse files
committed
CHORE - Add spatie/pixelmatch-php package and fix test
1 parent 78c3aed commit 442f9e6

File tree

5 files changed

+103
-13
lines changed

5 files changed

+103
-13
lines changed

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"spatie/laravel-ignition": "^2.4",
3333
"spatie/laravel-schedule-monitor": "^3.7",
3434
"spatie/laravel-sitemap": "^7.2",
35+
"spatie/pixelmatch-php": "^1.1",
3536
"symfony/http-client": "^7.0",
3637
"symfony/mailgun-mailer": "^7.0"
3738
},

composer.lock

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

package-lock.json

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

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,8 @@
2020
"tailwindcss": "^3.0.2",
2121
"textarea-caret": "^3.1.0",
2222
"vite": "^5.0.12"
23+
},
24+
"dependencies": {
25+
"pixelmatch": "^5.0.0"
2326
}
2427
}

tests/Integration/Jobs/GenerateSocialShareImageTest.php

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use App\Jobs\GenerateSocialShareImage;
44
use App\Models\Article;
55
use Illuminate\Foundation\Testing\DatabaseMigrations;
6+
use Spatie\Pixelmatch\Pixelmatch;
67
use Tests\TestCase;
78

89
uses(TestCase::class);
@@ -21,16 +22,11 @@
2122
);
2223

2324
expect(
24-
hash_file(
25-
'sha256',
26-
$generatedSocialShareImagePath
27-
)
28-
)->toBe(
29-
hash_file(
30-
'sha256',
25+
Pixelmatch::new(
26+
$generatedSocialShareImagePath,
3127
$this->getStub('generate_social_share_image.png')
32-
)
33-
);
28+
)->matches()
29+
)->toBeTrue();
3430

3531
unlink($generatedSocialShareImagePath);
3632
});

0 commit comments

Comments
 (0)