-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathComposerInstallationReflectorFactoryTest.php
54 lines (46 loc) · 1.58 KB
/
ComposerInstallationReflectorFactoryTest.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
47
48
49
50
51
52
53
54
<?php
declare(strict_types=1);
namespace RoaveTest\BackwardCompatibility\Factory;
use PHPUnit\Framework\TestCase;
use Roave\BackwardCompatibility\Factory\ComposerInstallationReflectorFactory;
use Roave\BackwardCompatibility\LocateSources\LocateSources;
use Roave\BetterReflection\BetterReflection;
use Roave\BetterReflection\SourceLocator\Type\SourceLocator;
use Roave\BetterReflection\SourceLocator\Type\StringSourceLocator;
use function uniqid;
/** @covers \Roave\BackwardCompatibility\Factory\ComposerInstallationReflectorFactory */
final class ComposerInstallationReflectorFactoryTest extends TestCase
{
/**
* Note: this test is quite pointless, it is just in place to verify that there aren't any
* silly runtime-related regressions.
*/
public function testWillInstantiateLocator(): void
{
$path = uniqid('path', true);
$locateSources = $this->createMock(LocateSources::class);
$sources = new StringSourceLocator(
<<<'PHP'
<?php
/** an example */
class Dummy {}
PHP
,
(new BetterReflection())->astLocator(),
);
$locateSources
->expects(self::atLeastOnce())
->method('__invoke')
->with($path)
->willReturn($sources);
self::assertSame(
'/** an example */',
(new ComposerInstallationReflectorFactory($locateSources))(
$path,
$this->createMock(SourceLocator::class),
)
->reflectClass('Dummy')
->getDocComment(),
);
}
}