|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace AbterPhp\Framework\Bootstrappers\Filesystem; |
|
4
|
|
|
|
|
5
|
|
|
use AbterPhp\Framework\Constant\Env; |
|
6
|
|
|
use AbterPhp\Framework\Environments\Environment; |
|
7
|
|
|
use AbterPhp\Framework\Filesystem\FileFinder; |
|
8
|
|
|
use AbterPhp\Framework\Filesystem\IFileFinder; |
|
9
|
|
|
use AbterPhp\Framework\Module\Manager; |
|
10
|
|
|
use Opulence\Ioc\Container; |
|
11
|
|
|
use PHPUnit\Framework\TestCase; |
|
12
|
|
|
|
|
13
|
|
|
class FileFinderBootstrapperTest extends TestCase |
|
14
|
|
|
{ |
|
15
|
|
|
/** @var FileFinderBootstrapper */ |
|
16
|
|
|
protected FileFinderBootstrapper $sut; |
|
17
|
|
|
|
|
18
|
|
|
protected Manager $moduleManagerMock; |
|
19
|
|
|
|
|
20
|
|
|
public function setUp(): void |
|
21
|
|
|
{ |
|
22
|
|
|
global $abterModuleManager; |
|
23
|
|
|
|
|
24
|
|
|
$this->sut = new FileFinderBootstrapper(); |
|
25
|
|
|
|
|
26
|
|
|
$this->moduleManagerMock = $this->getMockBuilder(Manager::class)->disableOriginalConstructor()->getMock(); |
|
27
|
|
|
|
|
28
|
|
|
$abterModuleManager = $this->moduleManagerMock; |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
public function tearDown(): void |
|
32
|
|
|
{ |
|
33
|
|
|
global $abterModuleManager; |
|
34
|
|
|
|
|
35
|
|
|
Environment::unsetVar(Env::DIR_PUBLIC); |
|
36
|
|
|
|
|
37
|
|
|
$abterModuleManager = null; |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
public function testRegisterBindings() |
|
41
|
|
|
{ |
|
42
|
|
|
Environment::setVar(Env::DIR_PUBLIC, '/tmp/foo'); |
|
43
|
|
|
|
|
44
|
|
|
$assetsPaths = ['foo' => ['bar']]; |
|
45
|
|
|
|
|
46
|
|
|
$this->moduleManagerMock->expects($this->once())->method('getAssetsPaths')->willReturn($assetsPaths); |
|
|
|
|
|
|
47
|
|
|
|
|
48
|
|
|
$container = new Container(); |
|
49
|
|
|
|
|
50
|
|
|
$this->sut->registerBindings($container); |
|
51
|
|
|
|
|
52
|
|
|
$actual = $container->resolve(FileFinder::class); |
|
53
|
|
|
$this->assertInstanceOf(FileFinder::class, $actual); |
|
54
|
|
|
|
|
55
|
|
|
$actual = $container->resolve(IFileFinder::class); |
|
56
|
|
|
$this->assertInstanceOf(IFileFinder::class, $actual); |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.