Skip to content

Commit

Permalink
Add test for composer files autoload
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod committed Dec 13, 2021
1 parent 06cd993 commit 08f9a78
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/ComposerRequireCheckerTest/Cli/CheckCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down
6 changes: 6 additions & 0 deletions test/fixtures/autoloadedFiles/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "example/library",
"autoload": {
"files": ["src/include.php"]
}
}
5 changes: 5 additions & 0 deletions test/fixtures/autoloadedFiles/src/include.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?php

declare(strict_types=1);

require_once __DIR__ . '/noop.php';
9 changes: 9 additions & 0 deletions test/fixtures/autoloadedFiles/src/noop.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

namespace Project\Functions;

function noop() : void
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]

0 comments on commit 08f9a78

Please sign in to comment.