Skip to content

Commit

Permalink
#469 enum p8
Browse files Browse the repository at this point in the history
  • Loading branch information
eventhorizonpl committed Jan 27, 2022
1 parent 979cb7b commit 1f400d5
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 20 deletions.
3 changes: 2 additions & 1 deletion src/Factory/ReminderMessageFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Factory;

use App\Entity\ReminderMessage;
use App\Enum\ReminderMessageTypeEnum;
use Symfony\Component\Uid\Uuid;

class ReminderMessageFactory
Expand All @@ -19,7 +20,7 @@ public function createReminderMessage(): ReminderMessage

public function createReminderMessageWithRequired(
string $content,
string $type
ReminderMessageTypeEnum $type
): ReminderMessage {
$reminderMessage = $this->createReminderMessage();

Expand Down
5 changes: 3 additions & 2 deletions src/Factory/ReportFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Factory;

use App\Entity\Report;
use App\Enum\{ReportStatusEnum, ReportTypeEnum};
use Symfony\Component\Uid\Uuid;

class ReportFactory
Expand All @@ -19,8 +20,8 @@ public function createReport(): Report

public function createReportWithRequired(
array $data,
string $status,
string $type
ReportStatusEnum $status,
ReportTypeEnum $type
): Report {
$report = $this->createReport();

Expand Down
3 changes: 2 additions & 1 deletion src/Factory/RewardFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Factory;

use App\Entity\Reward;
use App\Enum\RewardTypeEnum;
use Symfony\Component\Uid\Uuid;

class RewardFactory
Expand All @@ -21,7 +22,7 @@ public function createRewardWithRequired(
bool $isAwarded,
string $name,
int $requiredNumberOfCompletions,
string $type
RewardTypeEnum $type
): Reward {
$reward = $this->createReward();

Expand Down
3 changes: 2 additions & 1 deletion src/Factory/RoutineFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Factory;

use App\Entity\Routine;
use App\Enum\RoutineTypeEnum;
use Symfony\Component\Uid\Uuid;

class RoutineFactory
Expand All @@ -20,7 +21,7 @@ public function createRoutine(): Routine
public function createRoutineWithRequired(
bool $isEnabled,
string $name,
string $type
RoutineTypeEnum $type
): Routine {
$routine = $this->createRoutine();

Expand Down
5 changes: 2 additions & 3 deletions tests/Factory/ReminderMessageFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Tests\Factory;

use App\Entity\ReminderMessage;
use App\Enum\ReminderMessageTypeEnum;
use App\Factory\ReminderMessageFactory;
use App\Tests\AbstractTestCase;
use Faker\{Factory, Generator};
Expand Down Expand Up @@ -47,9 +48,7 @@ public function testCreateReminderMessage(): void
public function testCreateReminderMessageWithRequired(): void
{
$content = $this->faker->sentence();
$type = $this->faker->randomElement(
ReminderMessage::getTypeFormChoices()
);
$type = ReminderMessageTypeEnum::EMAIL;
$reminderMessageFactory = new ReminderMessageFactory();
$reminderMessage = $reminderMessageFactory->createReminderMessageWithRequired(
$content,
Expand Down
9 changes: 3 additions & 6 deletions tests/Factory/ReportFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Tests\Factory;

use App\Entity\Report;
use App\Enum\{ReportStatusEnum, ReportTypeEnum};
use App\Factory\ReportFactory;
use App\Tests\AbstractTestCase;
use Faker\{Factory, Generator};
Expand Down Expand Up @@ -47,12 +48,8 @@ public function testCreateReport(): void
public function testCreateReportWithRequired(): void
{
$data = $this->faker->words();
$status = $this->faker->randomElement(
Report::getStatusFormChoices()
);
$type = $this->faker->randomElement(
Report::getTypeFormChoices()
);
$status = ReportStatusEnum::INITIAL;
$type = ReportTypeEnum::POST_REMIND_MESSAGES;
$reportFactory = new ReportFactory();
$report = $reportFactory->createReportWithRequired(
$data,
Expand Down
5 changes: 2 additions & 3 deletions tests/Factory/RewardFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Tests\Factory;

use App\Entity\Reward;
use App\Enum\RewardTypeEnum;
use App\Factory\RewardFactory;
use App\Tests\AbstractTestCase;
use Faker\{Factory, Generator};
Expand Down Expand Up @@ -49,9 +50,7 @@ public function testCreateRewardWithRequired(): void
$isAwarded = $this->faker->boolean();
$name = $this->faker->sentence();
$requiredNumberOfCompletions = $this->faker->randomNumber();
$type = $this->faker->randomElement(
Reward::getTypeFormChoices()
);
$type = RewardTypeEnum::ALL;
$rewardFactory = new RewardFactory();
$reward = $rewardFactory->createRewardWithRequired(
$isAwarded,
Expand Down
5 changes: 2 additions & 3 deletions tests/Factory/RoutineFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace App\Tests\Factory;

use App\Entity\Routine;
use App\Enum\RoutineTypeEnum;
use App\Factory\RoutineFactory;
use App\Tests\AbstractTestCase;
use Faker\{Factory, Generator};
Expand Down Expand Up @@ -48,9 +49,7 @@ public function testCreateRoutineWithRequired(): void
{
$isEnabled = $this->faker->boolean();
$name = $this->faker->sentence();
$type = $this->faker->randomElement(
Routine::getTypeFormChoices()
);
$type = RoutineTypeEnum::HOBBY;
$routineFactory = new RoutineFactory();
$routine = $routineFactory->createRoutineWithRequired(
$isEnabled,
Expand Down

0 comments on commit 1f400d5

Please sign in to comment.