From 97b1ca54d03a2974c8dfd94d5903892377fa264c Mon Sep 17 00:00:00 2001 From: Graham Aitken Date: Sun, 21 Jul 2024 22:15:16 +0100 Subject: [PATCH 1/9] Create contacts config --- config/contacts.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 config/contacts.php diff --git a/config/contacts.php b/config/contacts.php new file mode 100644 index 00000000..c1b14264 --- /dev/null +++ b/config/contacts.php @@ -0,0 +1,19 @@ + [ + 'address' => env('CONTACT_OWNER_EMAIL', 'admin@example.com'), + 'name' => env('CONTACT_OWNER_NAME', 'superadmin'), + ], + +]; From d14781c5f9a0e2fb17d3cff2dc11de109f0f0a53 Mon Sep 17 00:00:00 2001 From: Graham Aitken Date: Sun, 21 Jul 2024 22:15:49 +0100 Subject: [PATCH 2/9] Add contacts example DotEnv variables --- .env.example | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.env.example b/.env.example index 8ff34e98..392daa73 100644 --- a/.env.example +++ b/.env.example @@ -77,6 +77,11 @@ APP_IMAGE_OPEN_GRAPH="resources/img/open-graph.png" APP_LINK_PROJECT_REPO="https://github.com/musimana/bassform" APP_USER_HOMEPAGE="dashboard" +# USED FOR PROJECT CONTACTS | SEE: ./config/contacts.php + +CONTACT_OWNER_EMAIL="${MAIL_FROM_ADDRESS}" +CONTACT_OWNER_NAME="${MAIL_FROM_NAME}" + # USED TO CONTROL DUSK TEST SETTINGS | SEE: ./config/dusk.php ## FRAMEWORK DUSK TEST SETTINGS From 6ae7ba10cacae6a4679d4dad6f29e0c85ef22a6c Mon Sep 17 00:00:00 2001 From: Graham Aitken Date: Sun, 21 Jul 2024 22:16:12 +0100 Subject: [PATCH 3/9] Update UserSeeder primary user logic --- database/seeders/UserSeeder.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/database/seeders/UserSeeder.php b/database/seeders/UserSeeder.php index 853f461b..6b244600 100644 --- a/database/seeders/UserSeeder.php +++ b/database/seeders/UserSeeder.php @@ -10,12 +10,12 @@ final class UserSeeder extends Seeder /** Run the database seeds. */ public function run(): void { - $primary_user = User::where([['email', config('mail.from.address')]])->first(); + $primary_user = User::where([['email', config('contacts.owner.address')]])->first(); if (!$primary_user) { User::factory()->isAdmin()->create([ - 'name' => config('mail.from.name', 'admin'), - 'email' => config('mail.from.address', 'admin@example.com'), + 'name' => config('contacts.owner.name'), + 'email' => config('contacts.owner.address'), ]); } From d6020f0e8d563ce87faae55955c757eeba110784 Mon Sep 17 00:00:00 2001 From: Graham Aitken Date: Sun, 21 Jul 2024 17:11:21 +0100 Subject: [PATCH 4/9] Golf ExampleBlock test enum exampleData method --- tests/Enums/ExampleBlock.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/Enums/ExampleBlock.php b/tests/Enums/ExampleBlock.php index efd57b0b..03d26e83 100644 --- a/tests/Enums/ExampleBlock.php +++ b/tests/Enums/ExampleBlock.php @@ -44,15 +44,13 @@ public function exampleData(): ?array ], ], ], - self::PRIVACY_POLICY => null, - self::SECTION_DIVIDER => null, - self::STACK => null, self::TABS => [ 'tabs' => ['Tab One', 'Tab Two'], 'tabContents' => ['

Tab one content.

', '

Tab two content.

'], ], self::WYSIWYG => ['html' => '

test

'], - default => BlockType::from($this->value)->staticData(), + self::UNKNOWN => BlockType::from($this->value)->staticData(), + default => null, }; } From aeef3ff9c733730da417efe491778450d3a46cbc Mon Sep 17 00:00:00 2001 From: Graham Aitken Date: Tue, 23 Jul 2024 23:27:29 +0100 Subject: [PATCH 5/9] Restore assertion to PrivacyPolicyContentResourceTest --- .../PrivacyPolicyContentResourceTest.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/tests/Unit/App/Http/Resources/Views/Public/Content/PrivacyPolicyContentResourceTest.php b/tests/Unit/App/Http/Resources/Views/Public/Content/PrivacyPolicyContentResourceTest.php index 557a5ad6..c50591f5 100644 --- a/tests/Unit/App/Http/Resources/Views/Public/Content/PrivacyPolicyContentResourceTest.php +++ b/tests/Unit/App/Http/Resources/Views/Public/Content/PrivacyPolicyContentResourceTest.php @@ -16,7 +16,24 @@ expect($actual['blocks']) ->toBeArray() - ->toHaveCount(3); + ->toHaveCount(3) + ->toMatchArray([ + [ + 'type' => 'wysiwyg', + 'data' => [ + 'html' => '

PRIVACY POLICY

+

' . config('app.name') . '

', + ], + ], + [ + 'type' => 'section-divider', + 'data' => [], + ], + [ + 'type' => 'privacy-policy', + 'data' => ['html' => view('partials.static-blocks.privacy')->render()], + ], + ]); expect($actual) ->toHaveCamelCaseKeys() From 0b4c9f4758016b6aac807e3c365c6d571ae4ef8a Mon Sep 17 00:00:00 2001 From: Graham Aitken Date: Tue, 23 Jul 2024 23:28:22 +0100 Subject: [PATCH 6/9] Remove font-family check from ToHaveCorrectHtmlHead assertions --- tests/Pest/Expectations/ToHaveCorrectHtmlHead.php | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/Pest/Expectations/ToHaveCorrectHtmlHead.php b/tests/Pest/Expectations/ToHaveCorrectHtmlHead.php index 1a3dab6d..818283a4 100644 --- a/tests/Pest/Expectations/ToHaveCorrectHtmlHead.php +++ b/tests/Pest/Expectations/ToHaveCorrectHtmlHead.php @@ -38,7 +38,6 @@ '', '', '', - '', '', '