Skip to content

Commit c4c0db8

Browse files
committed
[BUGFIX] Exclude absent line number from exception message
The bug was introduced by #1288, so has not been included in any release; thus a changelog entry is not justified.
1 parent 6a6e319 commit c4c0db8

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

tests/Unit/Parsing/SourceExceptionTest.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function getMessageReturnsMessageProvidedToConstructor(): void
2020
$message = 'The cake is a lie.';
2121
$exception = new SourceException($message);
2222

23-
self::assertStringContainsString($message, $exception->getMessage());
23+
self::assertSame($message, $exception->getMessage());
2424
}
2525

2626
/**
@@ -55,6 +55,17 @@ public function getMessageWithLineNumberProvidedIncludesLineNumber(): void
5555
self::assertStringContainsString(' [line no: ' . $lineNumber . ']', $exception->getMessage());
5656
}
5757

58+
/**
59+
* @test
60+
*/
61+
public function getMessageWithLineNumberProvidedIncludesMessage(): void
62+
{
63+
$message = 'There is no flatware.';
64+
$exception = new SourceException($message, 17);
65+
66+
self::assertStringContainsString($message, $exception->getMessage());
67+
}
68+
5869
/**
5970
* @test
6071
*/

0 commit comments

Comments
 (0)