Skip to content

Commit

Permalink
Add test case for current strictPSR scenario
Browse files Browse the repository at this point in the history
  • Loading branch information
PrinsFrank committed Apr 30, 2024
1 parent 8286a62 commit 3ee697c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/ClassMapGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string> $expected
* @param array<class-string, string> $actual
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

namespace ExpectedNamespace\UnexpectedSubNamespace;

class ClassWithIncorrectSubNamespace {}

0 comments on commit 3ee697c

Please sign in to comment.