Skip to content

Commit 0b99357

Browse files
committed
minor: add test for fallback dirs
1 parent 5e125cf commit 0b99357

File tree

5 files changed

+61
-0
lines changed

5 files changed

+61
-0
lines changed

phpunit.xml.dist

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
</testsuite>
1111
<testsuite name="Functional tests">
1212
<directory suffix=".phpt">tests/functional/error-handler/</directory>
13+
<file>tests/functional/fallback-dirs/test.phpt</file>
1314
<file>tests/functional/invalid-class/test.phpt</file>
1415
<file>tests/functional/nested-composer-projects/test.phpt</file>
1516
<file>tests/issue-13/test.phpt</file>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"repositories": [
3+
{
4+
"type": "vcs",
5+
"url": "../../.."
6+
}
7+
],
8+
"autoload": {
9+
"Kcs\\ClassFinder\\FunctionalTests\\": "src/"
10+
},
11+
"require": {
12+
"kcs/class-finder": "dev-master",
13+
"symfony/string": "*"
14+
}
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Symfony\Component\String;
6+
7+
class LazyString implements \Stringable, \JsonSerializable
8+
{
9+
10+
public function __toString(): string
11+
{
12+
return 'test';
13+
}
14+
15+
public function jsonSerialize(): mixed
16+
{
17+
return [];
18+
}
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Kcs\ClassFinder\FunctionalTests;
6+
7+
class Foobar
8+
{
9+
}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
--TEST--
2+
Fallback directories
3+
--INI--
4+
error_reporting=E_ALL & ~E_NOTICE & ~E_DEPRECATED
5+
--FILE--
6+
<?php
7+
require_once __DIR__ . '/vendor/autoload.php';
8+
9+
$finder = (new Kcs\ClassFinder\Finder\ComposerFinder())->skipBogonFiles();
10+
$arr = iterator_to_array($finder);
11+
12+
/** @var ReflectionClass $class */
13+
$class = $arr[\Symfony\Component\String\LazyString::class];
14+
echo str_replace(DIRECTORY_SEPARATOR, '/', $class->getFileName());
15+
?>
16+
--EXPECTF--
17+
%s/tests/functional/fallback-dirs/vendor/symfony/string/LazyString.php

0 commit comments

Comments
 (0)