diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index a1861cb..6df6eb9 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -41,10 +41,9 @@ jobs:
composer-options: ${{ matrix.composer_flags }}
- name: Install Composer dependencies (tests)
- uses: ramsey/composer-install@v3
- with:
- composer-options: ${{ matrix.composer_flags }}
- working-directory: tests/issue-13
+ run: php tests/install-deps.php
+ env:
+ COMPOSER_FLAGS: ${{ matrix.composer_flags }}
- run: vendor/bin/phpunit
if: ${{ matrix.php_version != '8.2' }}
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 23900bf..4715d42 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -9,7 +9,8 @@
tests/unit/
- tests/functional/
+ tests/functional/error-handler/
+ tests/functional/nested-composer-projects/test.phpt
tests/issue-13/test.phpt
tests/issue-13/test-path-callback.phpt
diff --git a/tests/functional/lists-all-classes-in-project.phpt b/tests/functional/lists-all-classes-in-project.phpt
index e98decb..4b671f8 100644
--- a/tests/functional/lists-all-classes-in-project.phpt
+++ b/tests/functional/lists-all-classes-in-project.phpt
@@ -5,9 +5,9 @@ ComposerFinder - should list all classes in a project w/o autoloading
require __DIR__ . '/../../vendor/autoload.php';
$finder = (new Kcs\ClassFinder\Finder\ComposerFinder())->useAutoloading(false);
-$classes = iterator_to_array($finder);
+iterator_to_array($finder);
-printf('> found %d class(es)' . PHP_EOL, count($classes));
+echo "OK";
?>
---EXPECTF--
-> found %d class(es)
+--EXPECT--
+OK
diff --git a/tests/functional/nested-composer-projects/composer.json b/tests/functional/nested-composer-projects/composer.json
new file mode 100644
index 0000000..47d7dad
--- /dev/null
+++ b/tests/functional/nested-composer-projects/composer.json
@@ -0,0 +1,11 @@
+{
+ "repositories": [
+ {
+ "type": "vcs",
+ "url": "../../.."
+ }
+ ],
+ "require": {
+ "kcs/class-finder": "^1.0@dev"
+ }
+}
diff --git a/tests/functional/nested-composer-projects/otherProject/composer.json b/tests/functional/nested-composer-projects/otherProject/composer.json
new file mode 100644
index 0000000..c1aa096
--- /dev/null
+++ b/tests/functional/nested-composer-projects/otherProject/composer.json
@@ -0,0 +1,5 @@
+{
+ "require": {
+ "nikic/php-parser": "^4.18 || ^5.0"
+ }
+}
diff --git a/tests/functional/nested-composer-projects/test.phpt b/tests/functional/nested-composer-projects/test.phpt
new file mode 100644
index 0000000..910cb6b
--- /dev/null
+++ b/tests/functional/nested-composer-projects/test.phpt
@@ -0,0 +1,14 @@
+--TEST--
+ComposerFinder - nested composer projects
+--FILE--
+
+--EXPECT--
+OK
diff --git a/tests/install-deps.php b/tests/install-deps.php
new file mode 100644
index 0000000..dc6fa52
--- /dev/null
+++ b/tests/install-deps.php
@@ -0,0 +1,39 @@
+ $file->getBasename()[0] !== '.',
+ ),
+ RecursiveIteratorIterator::LEAVES_ONLY | RecursiveIteratorIterator::CHILD_FIRST,
+ );
+
+ foreach ($files as $filepath => $info) {
+ if (! $info->isFile()) {
+ continue;
+ }
+
+ if ($info->getFilename() === 'composer.json') {
+ if (basename(dirname($info->getPath())) === 'vendor') {
+ continue;
+ }
+
+ $descriptorspec = [STDIN, STDOUT, STDERR];
+ $proc = proc_open(trim('composer install ' . getenv('COMPOSER_FLAGS') ?: ''), $descriptorspec, $pipes, $info->getPath());
+ for ($running = true; $running;) {
+ $status = proc_get_status($proc);
+ $running = $status['running'];
+ $exitcode = $status['exitcode'];
+ }
+
+ if ($exitcode !== 0) {
+ return;
+ }
+ }
+ }
+ }
+}
diff --git a/tests/issue-13/test-path-callback.phpt b/tests/issue-13/test-path-callback.phpt
index 84dfecd..5ad9d8a 100644
--- a/tests/issue-13/test-path-callback.phpt
+++ b/tests/issue-13/test-path-callback.phpt
@@ -11,7 +11,8 @@ $count = 0;
foreach ($finder as $className => $reflector) {
++$count;
}
-printf('> found %d class(es)' . PHP_EOL, $count);
+
+echo "OK"
?>
---EXPECTF--
-> found %d class(es)
+--EXPECT--
+OK
diff --git a/tests/issue-13/test.phpt b/tests/issue-13/test.phpt
index c140e62..4a0f0d8 100644
--- a/tests/issue-13/test.phpt
+++ b/tests/issue-13/test.phpt
@@ -11,7 +11,8 @@ $count = 0;
foreach ($finder as $className => $reflector) {
++$count;
}
-printf('> found %d class(es)' . PHP_EOL, $count);
+
+echo "OK"
?>
---EXPECTF--
-> found %d class(es)
+--EXPECT--
+OK