diff --git a/tests/ClassMapGeneratorTest.php b/tests/ClassMapGeneratorTest.php index 393a69e..6e4e5ca 100644 --- a/tests/ClassMapGeneratorTest.php +++ b/tests/ClassMapGeneratorTest.php @@ -240,6 +240,18 @@ public function testCreateMapDoesNotHitRegexBacktraceLimit(): void self::assertEqualsNormalized($expected, $result); } + public function testGetPSR4Violations(): void + { + $this->generator->scanPaths(__DIR__ . '/Fixtures/psrViolations', null, 'psr-4', 'ExpectedNamespace\\'); + $classMap = $this->generator->getClassMap(); + static::assertSame( + [ + 'Class ExpectedNamespace\UnexpectedSubNamespace\ClassWithIncorrectSubNamespace located in ./tests/Fixtures/psrViolations/ClassWithIncorrectSubNamespace.php does not comply with psr-4 autoloading standard. Skipping.', + ], + $classMap->getPsrViolations() + ); + } + /** * @param array $expected * @param array $actual diff --git a/tests/Fixtures/psrViolations/ClassWithIncorrectSubNamespace.php b/tests/Fixtures/psrViolations/ClassWithIncorrectSubNamespace.php new file mode 100644 index 0000000..03f7025 --- /dev/null +++ b/tests/Fixtures/psrViolations/ClassWithIncorrectSubNamespace.php @@ -0,0 +1,5 @@ +