1
0
Fork 0
mirror of https://github.com/composer/composer synced 2025-05-09 00:22:53 +00:00

Allow --strict-psr in DumpAutoloadCommand also with --classmap-authoritative (#11607)

This commit is contained in:
Martin Herndl 2023-08-30 21:43:16 +02:00 committed by GitHub
parent 02e4a2d1a3
commit 6fd145f01e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View file

@ -75,12 +75,22 @@ class DumpAutoloadCommandTest extends TestCase
$this->assertMatchesRegularExpression('/Generated optimized autoload files \(authoritative\) containing \d+ classes/', $output);
}
public function testUsingClassmapAuthoritativeAndStrictPsr(): void
{
$appTester = $this->getApplicationTester();
$this->assertSame(0, $appTester->run(['command' => 'dump-autoload', '--classmap-authoritative' => true, '--strict-psr' => true]));
$output = $appTester->getDisplay(true);
$this->assertStringContainsString('Generating optimized autoload files', $output);
$this->assertMatchesRegularExpression('/Generated optimized autoload files \(authoritative\) containing \d+ classes/', $output);
}
public function testStrictPsrDoesNotWorkWithoutOptimizedAutoloader(): void
{
$appTester = $this->getApplicationTester();
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('--strict-psr mode only works with optimized autoloader, use --optimize if you want a strict return value.');
$this->expectExceptionMessage('--strict-psr mode only works with optimized autoloader, use --optimize or --classmap-authoritative if you want a strict return value.');
$appTester->run(['command' => 'dump-autoload', '--strict-psr' => true]);
}