Skip to content

Commit

Permalink
Revert id checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Kolb committed Aug 2, 2024
1 parent 840921e commit 52e7c71
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 68 deletions.
22 changes: 0 additions & 22 deletions src/ValueObject/Exception/DifferentId.php

This file was deleted.

8 changes: 0 additions & 8 deletions src/ValueObject/Id.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ public function __toString(): string
*/
public function isEqualTo(self $id): bool
{
if (static::class !== $id::class) {
throw new Exception\DifferentId($this, $id);
}

return $this->value === $id->value;
}

Expand All @@ -52,10 +48,6 @@ public function isEqualTo(self $id): bool
*/
public function isNotEqualTo(self $id): bool
{
if (static::class !== $id::class) {
throw new Exception\DifferentId($this, $id);
}

return $this->value !== $id->value;
}

Expand Down
38 changes: 0 additions & 38 deletions tests/ValueObject/IdTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,6 @@ public function user_id_is_equal(): void
self::assertTrue($userId1->isEqualTo($userId2));
}

/**
* @test
*
* @covers ::isEqualTo
*/
public function user_id_is_equal_fails_with_different_ids(): void
{
// -- Assert
$this->expectException(Exception\DifferentId::class);

// -- Arrange
$userId = UserId::fromString('f41e0af4-88c4-4d79-9c1a-6e8ea34a956f');
$projectId = ProjectId::fromString('f41e0af4-88c4-4d79-9c1a-6e8ea34a956f');

// -- Act
/** @psalm-suppress InvalidArgument */
self::assertTrue($userId->isEqualTo($projectId));
}

/**
* @test
*
Expand All @@ -92,25 +73,6 @@ public function user_id_is_not_equal(): void
self::assertTrue($userId1->isNotEqualTo($userId2));
}

/**
* @test
*
* @covers ::isNotEqualTo
*/
public function user_id_is_not_equal_fails_with_different_ids(): void
{
// -- Assert
$this->expectException(Exception\DifferentId::class);

// -- Arrange
$userId = UserId::fromString('f41e0af4-88c4-4d79-9c1a-6e8ea34a956f');
$projectId = ProjectId::fromString('f41e0af4-88c4-4d79-9c1a-6e8ea34a956f');

// -- Act
/** @psalm-suppress InvalidArgument */
self::assertTrue($userId->isNotEqualTo($projectId));
}

/**
* @test
*
Expand Down

0 comments on commit 52e7c71

Please sign in to comment.