-
-
Notifications
You must be signed in to change notification settings - Fork 117
/
SelfTest.php
46 lines (40 loc) · 1.31 KB
/
SelfTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace Phpactor\WorseReflection\Tests\Inference;
use Generator;
use Phpactor\TextDocument\TextDocumentBuilder;
use Phpactor\WorseReflection\Tests\Integration\IntegrationTestCase;
class SelfTest extends IntegrationTestCase
{
public const DISABLED_TESTS = [
// disabling the includeWalker because it barely works
// and it causes severe performance issues.
'require_and_include',
];
/**
* @dataProvider provideSelf
*/
public function testSelf(string $path): void
{
$source = TextDocumentBuilder::fromUri($path)->build();
$reflector = $this->createBuilder($source)->enableCache()->build();
$reflector->reflectOffset($source, mb_strlen($source));
// the wrAssertType function in the source code will cause
// an exception to be thrown if it fails
$this->addToAssertionCount(1);
}
/**
* @return Generator<mixed>mixed
*/
public function provideSelf(): Generator
{
foreach ((array)glob(__DIR__ . '/*/*.test') as $fname) {
$dirName = basename(dirname((string)$fname));
if (in_array($dirName, self::DISABLED_TESTS)) {
continue;
}
yield $dirName .' ' . basename((string)$fname) => [
$fname
];
}
}
}