1
0
Fork 0

Add test case for `DumpAutoloadCommand` with failing --strict-psr check (#11606)

pull/11590/head
Martin Herndl 2023-08-30 21:42:45 +02:00 committed by GitHub
parent db53c65986
commit 02e4a2d1a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions

View File

@ -47,6 +47,24 @@ class DumpAutoloadCommandTest extends TestCase
$this->assertMatchesRegularExpression('/Generated optimized autoload files containing \d+ classes/', $output);
}
public function testFailsUsingStrictPsrIfClassMapViolationsAreFound(): void
{
$dir = $this->initTempComposer([
'autoload' => [
'psr-4' => [
'Application\\' => 'src',
]
]
]);
mkdir($dir . '/src/');
file_put_contents($dir . '/src/Foo.php', '<?php namespace Application\Src; class Foo {}');
$appTester = $this->getApplicationTester();
$this->assertSame(1, $appTester->run(['command' => 'dump-autoload', '--optimize' => true, '--strict-psr' => true]));
$output = $appTester->getDisplay(true);
$this->assertMatchesRegularExpression('/Class Application\\\Src\\\Foo located in .*? does not comply with psr-4 autoloading standard. Skipping./', $output);
}
public function testUsingClassmapAuthoritative(): void
{
$appTester = $this->getApplicationTester();