Skip to content

Commit

Permalink
CS formatting for the tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
koencaerels committed Feb 19, 2024
1 parent 9166761 commit 5dbb2ee
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 31 deletions.
6 changes: 3 additions & 3 deletions application/YoshiKan/Domain/Model/Member/MemberRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public function findByNameOrDateOfBirth(string $firstname, string $lastname, \Da
public function search(
string $keyword = '',
int $yearOfBirth = 0,
Location $location = null,
Grade $grade = null,
?Location $location = null,
?Grade $grade = null,
int $minYearOfBirth = 0,
int $maxYearOfBirth = 0,
bool $isActive = null,
?bool $isActive = null,
): array;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,11 +131,11 @@ public function findByNameOrDateOfBirth(string $firstname, string $lastname, \Da
public function search(
string $keyword = '',
int $yearOfBirth = 0,
Location $location = null,
Grade $grade = null,
?Location $location = null,
?Grade $grade = null,
int $minYearOfBirth = 0,
int $maxYearOfBirth = 0,
bool $isActive = null,
?bool $isActive = null,
): array {
$q = $this->createQueryBuilder('t')->andWhere('0 = 0');
if (0 != mb_strlen(trim($keyword))) {
Expand Down
12 changes: 5 additions & 7 deletions tests/Unit/YoshiKan/Domain/Model/Common/ChecksumEntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,18 @@
use App\YoshiKan\Domain\Model\Common\ChecksumEntity;

it('creates a content code', function () {

$checksumEntity = new class () {
$checksumEntity = new class() {
use ChecksumEntity;

private string $firstname = 'firstname';
private string $lastname = 'lastname';
private \DateTime $createdAt;
private \DateTime $updatedAt;
private DateTime $createdAt;
private DateTime $updatedAt;

public function __construct()
{
$this->createdAt = new \DateTime();
$this->updatedAt = new \DateTime();
$this->createdAt = new DateTime();
$this->updatedAt = new DateTime();
}
};
$contentString = hash('sha256', $_ENV['APP_SECRET']);
Expand All @@ -34,5 +33,4 @@ public function __construct()
$checksumEntity->setChecksum();

expect($checksumEntity->getChecksum())->toBe($checksum);

})->group('unit');
4 changes: 1 addition & 3 deletions tests/Unit/YoshiKan/Domain/Model/Common/IdEntityTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,12 @@
use Symfony\Component\Uid\Uuid;

it('creates identifiers for an object', function () {

$entityId = new class () {
$entityId = new class() {
use IdEntity;
};
$uuid = Uuid::v4();
$entityId->identify(1, $uuid);

expect($entityId->getId())->toBe(1)
->and($entityId->getUuid())->toBe($uuid);

})->group('unit');
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@
use App\YoshiKan\Domain\Model\Common\SequenceEntity;

it('creates sequences for an object', function () {

$sequenceEntity = new class () {
$sequenceEntity = new class() {
use SequenceEntity;
};
$sequenceEntity->setSequence(1);
expect($sequenceEntity->getSequence())->toBe(1);

})->group('unit');
2 changes: 1 addition & 1 deletion tests/Unit/YoshiKan/Domain/Model/Member/GradeLogTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$member = ModelFactory::makeMember(Uuid::v4());
$fromGrade = ModelFactory::makeGrade(Uuid::v4());
$toGrade = ModelFactory::makeGrade(Uuid::v4());
$date = new \DateTimeImmutable();
$date = new DateTimeImmutable();
$remark = 'Promoted to next grade';
$gradeLog = GradeLog::make(
uuid: $uuid,
Expand Down
10 changes: 5 additions & 5 deletions tests/Unit/YoshiKan/Domain/Model/Member/MemberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
uuid: $uuid,
firstname: 'John',
lastname: 'Doe',
dateOfBirth: new \DateTimeImmutable('1990-01-01'),
dateOfBirth: new DateTimeImmutable('1990-01-01'),
gender: $gender,
grade: $grade,
location: $location,
Expand All @@ -33,7 +33,7 @@
);
expect($member->getFirstname())->toBe('John')
->and($member->getLastname())->toBe('Doe')
->and($member->getDateOfBirth())->toBeInstanceOf(\DateTimeImmutable::class)
->and($member->getDateOfBirth())->toBeInstanceOf(DateTimeImmutable::class)
->and($member->getGender())->toBe(Gender::M)
->and($member->getGrade())->toBe($grade)
->and($member->getLocation())->toBe($location)
Expand All @@ -57,7 +57,7 @@
uuid: $uuid,
firstname: 'John',
lastname: 'Doe',
dateOfBirth: new \DateTimeImmutable('1990-01-01'),
dateOfBirth: new DateTimeImmutable('1990-01-01'),
gender: $gender,
grade: $grade,
location: $location,
Expand All @@ -75,7 +75,7 @@
firstname: 'Jane',
lastname: 'Smith',
gender: Gender::V,
dateOfBirth: new \DateTimeImmutable('1995-05-05'),
dateOfBirth: new DateTimeImmutable('1995-05-05'),
status: MemberStatus::ACTIVE,
location: ModelFactory::makeLocation(Uuid::v4()),
nationalRegisterNumber: '98765432109',
Expand All @@ -92,7 +92,7 @@
);
expect($member->getFirstname())->toBe('Jane')
->and($member->getLastname())->toBe('Smith')
->and($member->getDateOfBirth())->toBeInstanceOf(\DateTimeImmutable::class)
->and($member->getDateOfBirth())->toBeInstanceOf(DateTimeImmutable::class)
->and($member->getGender())->toBe(Gender::V)
->and($member->getStatus())->toBe(MemberStatus::ACTIVE)
->and($member->getLocation())->not()->toBe($location)
Expand Down
8 changes: 4 additions & 4 deletions tests/Unit/YoshiKan/Domain/Model/Message/MessageTest.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<?php

use App\Tests\Unit\YoshiKan\Domain\Model\ModelFactory;
use App\YoshiKan\Domain\Model\Member\Member;
use App\YoshiKan\Domain\Model\Member\Subscription;
use App\YoshiKan\Domain\Model\Message\Message;
use App\Tests\Unit\YoshiKan\Domain\Model\ModelFactory;
use Symfony\Component\Uid\Uuid;

it('can create a message', function () {
$uuid = Uuid::v4();
$sendOn = new \DateTimeImmutable();
$sendOn = new DateTimeImmutable();
$message = Message::make(
uuid: $uuid,
sendOn: $sendOn,
Expand All @@ -32,7 +32,7 @@
$uuid = Uuid::v4();
$message = Message::make(
uuid: $uuid,
sendOn: new \DateTimeImmutable(),
sendOn: new DateTimeImmutable(),
fromName: 'John Doe',
fromEmail: '[email protected]',
toName: 'Jane Doe',
Expand All @@ -49,7 +49,7 @@
$uuid = Uuid::v4();
$message = Message::make(
uuid: $uuid,
sendOn: new \DateTimeImmutable(),
sendOn: new DateTimeImmutable(),
fromName: 'John Doe',
fromEmail: '[email protected]',
toName: 'Jane Doe',
Expand Down
2 changes: 1 addition & 1 deletion tests/Unit/YoshiKan/Domain/Model/ModelFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

class ModelFactory
{

public static function makeUser(int $id): User
{
$user = new User();
Expand All @@ -36,6 +35,7 @@ public static function makeUser(int $id): User
$user->setPassword('password');
$user->setRoles(['ROLE_USER']);
$user->setDisplayName('DisplayName');

return $user;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

use App\YoshiKan\Domain\Model\TwoFactor\MemberAccessCode;
use App\Tests\Unit\YoshiKan\Domain\Model\ModelFactory;
use App\YoshiKan\Domain\Model\TwoFactor\MemberAccessCode;
use Bolt\Entity\User;
use Symfony\Component\Uid\Uuid;

Expand Down

0 comments on commit 5dbb2ee

Please sign in to comment.