Skip to content

Commit

Permalink
add: Condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Yukihiro Arisawa committed Apr 30, 2024
1 parent 15c8d90 commit 0aa6d10
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/Domain/Enum/ConditionType.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

namespace Iamyukihiro\Aquarium\Domain\Enum;

class FishType
class ConditionType
{
public const MEDAKA = 'メダカ';
public const FINE = '元気';
public const BAD = '不調';
public const DEAD = '死亡';
}
3 changes: 2 additions & 1 deletion src/Domain/Logic/RandomMedakaGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Iamyukihiro\Aquarium\Domain\Logic;

use Iamyukihiro\Aquarium\Domain\Enum\BreedNameType;
use Iamyukihiro\Aquarium\Domain\Enum\ConditionType;
use Iamyukihiro\Aquarium\Domain\Enum\FishType;
use Iamyukihiro\Aquarium\Domain\Model\Fish\Medaka;
use Iamyukihiro\Aquarium\Domain\ValueObject\Breed;
Expand All @@ -26,7 +27,7 @@ public function generate(): Medaka
return new Medaka(
nickName: $this->nicknameGenerator->generate(),
breed: new Breed(FishType::MEDAKA, $this->pickBreedName()),
act: 'Swim',
condition: ConditionType::FINE,
birthday: now()
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Domain/Model/Fish/FishInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public function getNickName(): string;

public function getBreed(): Breed;

public function getAct(): string;
public function getCondition(): string;

public function getBirthday(): DateTimeImmutable;
}
6 changes: 3 additions & 3 deletions src/Domain/Model/Fish/Medaka.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Medaka implements FishInterface
public function __construct(
private string $nickName,
private Breed $breed,
private string $act,
private string $condition,
private DateTimeImmutable $birthday,
) {
}
Expand All @@ -27,9 +27,9 @@ public function getBreed(): Breed
return $this->breed;
}

public function getAct(): string
public function getCondition(): string
{
return $this->act;
return $this->condition;
}

public function getBirthday(): DateTimeImmutable
Expand Down
3 changes: 2 additions & 1 deletion tests/UseCase/AddMedakaUseCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
namespace Iamyukihiro\Aquarium\UseCase;

use Iamyukihiro\Aquarium\Domain\Enum\BreedNameType;
use Iamyukihiro\Aquarium\Domain\Enum\ConditionType;
use Iamyukihiro\Aquarium\Domain\Enum\FishType;
use Iamyukihiro\Aquarium\Domain\Logic\RandomMedakaGenerator;
use Iamyukihiro\Aquarium\Domain\Model\Fish\Medaka;
Expand Down Expand Up @@ -38,7 +39,7 @@ public function test(): void
$medaka = new Medaka(
nickName: 'テストメダカ',
breed: new Breed(FishType::MEDAKA, BreedNameType::YOUKIHI),
act: 'Sleeping',
condition: ConditionType::FINE,
birthday: now()
);
$this->randomMedakaGeneratorP->generate()->willReturn($medaka)->shouldBeCalled();
Expand Down

0 comments on commit 0aa6d10

Please sign in to comment.