From e4dbbe2a58148920fa9775bd81f5442a23642a24 Mon Sep 17 00:00:00 2001 From: Jonny Barnes Date: Tue, 31 Aug 2021 13:08:19 +0100 Subject: [PATCH] =?UTF-8?q?Make=20sure=20aaron=E2=80=99s=20profile=20image?= =?UTF-8?q?=20exists=20for=20generating=20h-card?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/Unit/NotesTest.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/Unit/NotesTest.php b/tests/Unit/NotesTest.php index 784f7a59..61cd9381 100644 --- a/tests/Unit/NotesTest.php +++ b/tests/Unit/NotesTest.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace Tests\Unit; use App\Models\{Contact, Media, Note, Place, Tag}; +use Illuminate\Filesystem\Filesystem; use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Facades\Cache; use GuzzleHttp\Client; @@ -65,8 +66,6 @@ class NotesTest extends TestCase */ public function specificProfileImageUsedInMakehcardsMethod(): void { - // phpcs:ignore - $expected = '

Hi Aaron Parecki Facebook

' . PHP_EOL; Contact::factory()->create([ 'nick' => 'aaron', 'name' => 'Aaron Parecki', @@ -74,9 +73,17 @@ class NotesTest extends TestCase 'twitter' => null, 'facebook' => 123456, ]); + $fileSystem = new Filesystem(); + $fileSystem->ensureDirectoryExists(public_path('/assets/profile-images/aaronparecki.com')); + if (!$fileSystem->exists(public_path('/assets/profile-images/aaronparecki.com/image'))) { + $fileSystem->copy('./tests/aaron.png', public_path('/assets/profile-images/aaronparecki.com/image')); + } $note = Note::factory()->create([ 'note' => 'Hi @aaron', ]); + + // phpcs:ignore + $expected = '

Hi Aaron Parecki Facebook

' . PHP_EOL; $this->assertEquals($expected, $note->note); }