Skip to content

Commit 7e9d3a5

Browse files
m.lauferm.laufer
authored andcommitted
Added possibility to use expectedExceptionMessageRegExp in addition to expectedExceptionMessage
1 parent 98aad80 commit 7e9d3a5

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

custom-standards/Flyeralarm/Sniffs/Docblock/ExpectedExceptionMessageSniff.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public function process(File $phpcsFile, $stackPtr)
2525
if (!$this->hasAnnotationInDoc($phpcsFile, $stackPtr, '@expectedException')) {
2626
return;
2727
}
28-
if ($this->hasAnnotationInDoc($phpcsFile, $stackPtr, '@expectedExceptionMessage')) {
28+
if ($this->hasAnnotationInDoc($phpcsFile, $stackPtr, '@expectedExceptionMessage')
29+
|| $this->hasAnnotationInDoc($phpcsFile, $stackPtr, '@expectedExceptionMessageRegExp')) {
2930
return;
3031
}
3132

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
// @expectedPass
4+
5+
namespace flyeralarm\Test;
6+
7+
class FooTest
8+
{
9+
/**
10+
* @expectedException \RuntimeException
11+
* @expectedExceptionMessageRegExp /The exception message can continue \w+/
12+
*/
13+
public function testBar()
14+
{
15+
}
16+
}

0 commit comments

Comments
 (0)