Skip to content

Commit 4fba748

Browse files
committed
Tests: fix composer autoload
1. Make the namespace of the `VariableAnalysisTest` file reflect the path the file. 2. Add an `autoload-dev` section to the `composer.json` * The unit tests are not shipped in the distribution package, so they are only available in a `dev` environment, which is exactly what `autoload-dev` is targetting. * Setting the `tests` directory as a secondary path for PSR4 autoload should fix compatibility with Composer 2.
1 parent 4804a39 commit 4fba748

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

composer.circleci.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
"VariableAnalysis\\": "VariableAnalysis/"
2727
}
2828
},
29+
"autoload-dev": {
30+
"psr-4": {
31+
"VariableAnalysis\\Tests\\": "tests/"
32+
}
33+
},
2934
"minimum-stability": "dev",
3035
"prefer-stable": true,
3136
"scripts": {

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
"VariableAnalysis\\": "VariableAnalysis/"
2727
}
2828
},
29+
"autoload-dev": {
30+
"psr-4": {
31+
"VariableAnalysis\\Tests\\": "tests/"
32+
}
33+
},
2934
"minimum-stability": "dev",
3035
"prefer-stable": true,
3136
"scripts": {

tests/Sniffs/VariableAnalysisTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
namespace VariableAnalysis\Tests\CodeAnalysis;
2+
namespace VariableAnalysis\Tests\Sniffs;
33

44
use VariableAnalysis\Tests\BaseTestCase;
55

0 commit comments

Comments
 (0)