diff --git a/tests/ClassMapGeneratorTest.php b/tests/ClassMapGeneratorTest.php index 393a69e..94af6b3 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', 'Foo\\'); + $classMap = $this->generator->getClassMap(); + static::assertSame( + [ + 'Class Foo\Bar\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..687a289 --- /dev/null +++ b/tests/Fixtures/psrViolations/ClassWithIncorrectSubNamespace.php @@ -0,0 +1,5 @@ +