-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGeneratorMockTrait.php
46 lines (38 loc) · 1.13 KB
/
GeneratorMockTrait.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 RonasIT\Support\Tests\Support;
use Laravel\Nova\NovaServiceProvider;
use RonasIT\Support\Traits\MockTrait;
trait GeneratorMockTrait
{
use MockTrait;
public function mockNativeGeneratorFunctions(...$functionCalls): void
{
$this->mockNativeFunction('\RonasIT\Support\Generators', $functionCalls);
}
public function mockNovaServiceProviderExists(bool $result = true): void
{
$this->mockNativeGeneratorFunctions(
$this->nativeClassExistsMethodCall([NovaServiceProvider::class, true], $result),
);
}
public function classExistsMethodCall(array $arguments, bool $result = true): array
{
return [
'function' => 'classExists',
'arguments' => $arguments,
'result' => $result
];
}
public function nativeClassExistsMethodCall(array $arguments, bool $result = true): array
{
return [
'function' => 'class_exists',
'arguments' => $arguments,
'result' => $result,
];
}
public function mockPhpFileContent(): string
{
return '<?php';
}
}