Skip to content

Commit 6bc9678

Browse files
committed
Added missing test
1 parent 94783c8 commit 6bc9678

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

tests/Sniffs/Namespaces/ReferenceUsedNamesOnlySniffTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,18 @@ public function testIgnoredNamesWithAllowFullyQualifiedExceptionsInNamespace()
529529
$this->assertNoSniffErrorInFile($report);
530530
}
531531

532+
public function testThrowExceptionForUndefinedKeyword()
533+
{
534+
$report = $this->checkFile(
535+
__DIR__ . '/data/unknownKeyword.php',
536+
['fullyQualifiedKeywords' => ['T_FOO']]
537+
);
538+
539+
$this->assertSame(1, $report->getErrorCount());
540+
$this->assertSame('unknownSniff', $report->getErrors()[1][1][0]['source']);
541+
$this->assertContains('Value for keyword token not found, constant "T_FOO" is not defined', $report->getErrors()[1][1][0]['message']);
542+
}
543+
532544

533545
public function testFixableReferenceViaFullyQualifiedName()
534546
{
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
namespace Foo;
4+
5+
class Foo implements \Baz, \Foo\Baz
6+
{
7+
8+
}

0 commit comments

Comments
 (0)