Skip to content

Commit

Permalink
Add missing mocked variables (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
mako321 authored Mar 28, 2023
1 parent 3f602c0 commit 2951b84
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Auth/VerifyUserAccountVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace EscolaLms\TemplatesEmail\Auth;

use EscolaLms\Core\Models\User;
use EscolaLms\TemplatesEmail\Core\EmailVariables;
use EscolaLms\Templates\Events\EventWrapper;
use Illuminate\Support\Facades\Lang;
Expand All @@ -10,6 +11,15 @@ class VerifyUserAccountVariables extends EmailVariables
{
const VAR_REGISTERED_USER_NAME = '@VarRegisteredUserName';

public static function mockedVariables(?User $user = null): array
{
$faker = \Faker\Factory::create();

return array_merge(parent::mockedVariables($user), [
self::VAR_REGISTERED_USER_NAME => $faker->name,
]);
}

public static function variablesFromEvent(EventWrapper $event): array
{
return array_merge(parent::variablesFromEvent($event), [
Expand Down
1 change: 1 addition & 0 deletions src/Cart/ProductAttachedVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public static function mockedVariables(?User $user = null): array
return array_merge(parent::mockedVariables(), [
self::VAR_USER_NAME => $faker->name(),
self::VAR_PRODUCT_NAME => $faker->word(),
self::VAR_PRODUCTABLES => $faker->word(),
]);
}

Expand Down
10 changes: 10 additions & 0 deletions src/Consultations/ReminderTrainerAboutTermVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace EscolaLms\TemplatesEmail\Consultations;

use EscolaLms\Consultations\Services\Contracts\ConsultationServiceContract;
use EscolaLms\Core\Models\User;
use EscolaLms\Templates\Events\EventWrapper;

class ReminderTrainerAboutTermVariables extends CommonConsultationVariables
Expand All @@ -17,6 +18,15 @@ public static function requiredVariables(): array
]);
}

public static function mockedVariables(?User $user = null): array
{
$faker = \Faker\Factory::create();
return array_merge(parent::mockedVariables(), [
self::VAR_CONSULTATION_USER_NAME => $faker->name,
self::VAR_JITSI_URL => $faker->url,
]);
}

public static function requiredVariablesInSection(string $sectionKey): array
{
if ($sectionKey === 'content') {
Expand Down
10 changes: 10 additions & 0 deletions src/Consultations/ReportTermVariables.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,22 @@

namespace EscolaLms\TemplatesEmail\Consultations;

use Carbon\Carbon;
use EscolaLms\Core\Models\User;
use EscolaLms\Templates\Events\EventWrapper;

class ReportTermVariables extends CommonConsultationVariables
{
const VAR_CONSULTATION_BUYER_NAME = '@VarConsultationBuyerName';

public static function mockedVariables(?User $user = null): array
{
$faker = \Faker\Factory::create();
return array_merge(parent::mockedVariables(), [
self::VAR_CONSULTATION_BUYER_NAME => $faker->name,
]);
}

public static function requiredVariables(): array
{
return array_merge(parent::requiredVariables(), [
Expand Down

0 comments on commit 2951b84

Please sign in to comment.