From 4f5b0e25300b28d4afb25d14598caf14ad5b189d Mon Sep 17 00:00:00 2001 From: Simon Podlipsky Date: Wed, 14 Apr 2021 11:30:42 +0200 Subject: [PATCH] Add test for composer files autoload --- test/ComposerRequireCheckerTest/Cli/CheckCommandTest.php | 9 +++++++++ test/fixtures/autoloadedFiles/composer.json | 6 ++++++ test/fixtures/autoloadedFiles/src/include.php | 5 +++++ test/fixtures/autoloadedFiles/src/noop.php | 9 +++++++++ .../autoloadedFiles/vendor/composer/installed.json | 1 + 5 files changed, 30 insertions(+) create mode 100644 test/fixtures/autoloadedFiles/composer.json create mode 100644 test/fixtures/autoloadedFiles/src/include.php create mode 100644 test/fixtures/autoloadedFiles/src/noop.php create mode 100644 test/fixtures/autoloadedFiles/vendor/composer/installed.json diff --git a/test/ComposerRequireCheckerTest/Cli/CheckCommandTest.php b/test/ComposerRequireCheckerTest/Cli/CheckCommandTest.php index 34b55d2c..b8551401 100644 --- a/test/ComposerRequireCheckerTest/Cli/CheckCommandTest.php +++ b/test/ComposerRequireCheckerTest/Cli/CheckCommandTest.php @@ -214,6 +214,15 @@ public function testSourceFileThatUsesDevDependency(): void ); } + public function testAutoloadedFiles(): void + { + $this->commandTester->execute([ + 'composer-json' => dirname(__DIR__, 2) . '/fixtures/autoloadedFiles/composer.json', + ]); + + self::assertSame(Command::SUCCESS, $this->commandTester->getStatusCode()); + } + public function testNoUnknownSymbolsFound(): void { $this->commandTester->execute([ diff --git a/test/fixtures/autoloadedFiles/composer.json b/test/fixtures/autoloadedFiles/composer.json new file mode 100644 index 00000000..cb459f94 --- /dev/null +++ b/test/fixtures/autoloadedFiles/composer.json @@ -0,0 +1,6 @@ +{ + "name": "example/library", + "autoload": { + "files": ["src/include.php"] + } +} diff --git a/test/fixtures/autoloadedFiles/src/include.php b/test/fixtures/autoloadedFiles/src/include.php new file mode 100644 index 00000000..fbed2896 --- /dev/null +++ b/test/fixtures/autoloadedFiles/src/include.php @@ -0,0 +1,5 @@ +