Skip to content

Commit 5439261

Browse files
committed
[avoid-builder-pattern] Assert -> assertThat
1 parent fcf8ddd commit 5439261

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

more-readable-code-avoiding-builder-pattern/1-traditional/traditional.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ function test_user_is_able_to_edit_video_with_enough_access_level(): void
4242
{
4343
$user = new User('some-id', 'some-name', 3);
4444

45-
assert(true, $user->canEditVideos());
45+
assertThat(true, $user->canEditVideos());
4646
}
4747

4848
function test_user_is_not_able_to_edit_videos_without_enough_access_level(): void
4949
{
5050
$user = new User('some-id', 'some-name', 1);
5151

52-
assert(false, $user->canEditVideos());
52+
assertThat(false, $user->canEditVideos());
5353
}
5454

55-
function assert(bool $expected, bool $actual): void
55+
function assertThat(bool $expected, bool $actual): void
5656
{
5757
if ($expected !== $actual) {
5858
throw new Exception('Condition not satisfied');

more-readable-code-avoiding-builder-pattern/2-builder_pattern/builder-pattern.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,17 @@ function test_user_is_able_to_edit_video_with_enough_access_level(): void
6969
{
7070
$user = (new UserBuilder())->withAccessLevel(3)->build();
7171

72-
assert(true, $user->canEditVideos());
72+
assertThat(true, $user->canEditVideos());
7373
}
7474

7575
function test_user_is_not_able_to_edit_videos_without_enough_access_level(): void
7676
{
7777
$user = (new UserBuilder())->withAccessLevel(1)->build();
7878

79-
assert(false, $user->canEditVideos());
79+
assertThat(false, $user->canEditVideos());
8080
}
8181

82-
function assert(bool $expected, bool $actual): void
82+
function assertThat(bool $expected, bool $actual): void
8383
{
8484
if ($expected !== $actual) {
8585
throw new Exception('Condition not satisfied');

more-readable-code-avoiding-builder-pattern/3-object_mother/test/object-mother.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ function test_user_is_able_to_edit_video_with_enough_access_level(): void
44
{
55
$user = UserStub::withAccessLevel(3);
66

7-
assert(true, $user->canEditVideos());
7+
assertThat(true, $user->canEditVideos());
88
}
99

1010
function test_user_is_not_able_to_edit_videos_without_enough_access_level(): void
1111
{
1212
$user = UserStub::withAccessLevel(1);
1313

14-
assert(false, $user->canEditVideos());
14+
assertThat(false, $user->canEditVideos());
1515
}
1616

17-
function assert(bool $expected, bool $actual): void
17+
function assertThat(bool $expected, bool $actual): void
1818
{
1919
if ($expected !== $actual) {
2020
throw new Exception('Condition not satisfied');

0 commit comments

Comments
 (0)