Skip to content

Commit 140dc74

Browse files
committed
chore: add message getter
1 parent e0f08b1 commit 140dc74

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/VerboseSpecification.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ public function withMessage(string $message): self
3030
);
3131
}
3232

33+
public function message(): string
34+
{
35+
return $this->message;
36+
}
37+
3338
/**
3439
* @param TCandidate $candidate
3540
*

tests/VerboseExceptionTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,17 @@ public function it_should_return_true_when_the_specification_is_satisfied_with_t
5555
// Assert
5656
$this->assertTrue($satisfied);
5757
}
58+
59+
/** @test */
60+
public function it_should_be_possible_to_receive_the_message(): void
61+
{
62+
// Arrange
63+
$specification = $this->specification->withMessage('This is the reason why it is dissatisfied.');
64+
65+
// Act
66+
$message = $specification->message();
67+
68+
// Assert
69+
$this->assertEquals('This is the reason why it is dissatisfied.', $message);
70+
}
5871
}

0 commit comments

Comments
 (0)