-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathNovaTestGeneratorMockTrait.php
45 lines (34 loc) · 1.23 KB
/
NovaTestGeneratorMockTrait.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
<?php
namespace RonasIT\Support\Tests\Support\NovaTestGeneratorTest;
use Mockery;
use RonasIT\Support\Tests\Support\FileSystemMock;
use RonasIT\Support\Tests\Support\GeneratorMockTrait;
trait NovaTestGeneratorMockTrait
{
use GeneratorMockTrait;
public function mockNovaRequestClassCall(): void
{
$mock = Mockery::mock('alias:Laravel\Nova\Http\Requests\NovaRequest');
$this->app->instance('Laravel\Nova\Http\Requests\NovaRequest', $mock);
}
public function mockFilesystem(): void
{
$fileSystemMock = new FileSystemMock;
$fileSystemMock->novaActions = [
'PublishPostAction.php' => $this->mockPhpFileContent(),
'ArchivePostAction.php' => $this->mockPhpFileContent(),
'BlockCommentAction.php' => $this->mockPhpFileContent(),
'UnPublishPostAction.txt' => 'text',
];
$fileSystemMock->novaModels = [
'WelcomeBonusResource.php' => $this->mockPhpFileContent(),
];
$fileSystemMock->models = [
'WelcomeBonus.php' => $this->mockPhpFileContent(),
];
$fileSystemMock->testFixtures = [
'NovaWelcomeBonusTest' => []
];
$fileSystemMock->setStructure();
}
}