44
55use Illuminate \Database \Connection ;
66use Illuminate \Support \Facades \DB ;
7- use org \bovigo \vfs \vfsStream ;
8- use RonasIT \Support \Generators \NovaResourceGenerator ;
97use RonasIT \Support \Generators \NovaTestGenerator ;
10- use RonasIT \Support \Generators \TestsGenerator ;
118use RonasIT \Support \Tests \Support \Command \Models \Post ;
129use RonasIT \Support \Tests \Support \FileSystemMock ;
1310use RonasIT \Support \Tests \Support \GeneratorMockTrait ;
@@ -20,22 +17,12 @@ trait CommandMockTrait
2017
2118 public function mockFilesystemPostModelExists (): void
2219 {
23- $ structure = [
24- 'app ' => [
25- 'Http ' => [
26- 'Controllers ' => [],
27- ],
28- 'Models ' => [
29- 'Post.php ' => '<?php '
30- ],
31- 'Repositories ' => []
32- ],
33- 'config ' => [
34- 'entity-generator.php ' => ''
35- ],
36- ];
20+ $ fileSystemMock = new FileSystemMock ;
21+
22+ $ fileSystemMock ->models = ['Post.php ' => $ this ->mockPhpFileContent ()];
23+ $ fileSystemMock ->config = ['entity-generator.php ' => '' ];
3724
38- vfsStream:: create ( $ structure );
25+ $ fileSystemMock -> setStructure ( );
3926 }
4027
4128 public function mockFilesystem (): void
@@ -51,58 +38,7 @@ public function mockFilesystem(): void
5138
5239 public function mockGenerator (): void
5340 {
54- $ this ->mockClass (TestsGenerator::class, [
55- $ this ->functionCall (
56- name: 'getModelClass ' ,
57- arguments: ['Post ' ],
58- result: 'RonasIT \\Support \\Tests \\Support \\Command \\Models \\Post ' ,
59- ),
60- $ this ->functionCall (
61- name: 'getModelClass ' ,
62- arguments: ['Post ' ],
63- result: 'RonasIT \\Support \\Tests \\Support \\Command \\Models \\Post ' ,
64- ),
65- $ this ->functionCall (
66- name: 'getModelClass ' ,
67- arguments: ['Post ' ],
68- result: 'RonasIT \\Support \\Tests \\Support \\Command \\Models \\Post ' ,
69- ),
70- $ this ->functionCall (
71- name: 'getModelClass ' ,
72- arguments: ['Post ' ],
73- result: 'RonasIT \\Support \\Tests \\Support \\Command \\Models \\Post ' ,
74- ),
75- ]);
76-
77- $ this ->mockClass (NovaResourceGenerator::class, [
78- $ this ->functionCall (
79- name: 'getModelClass ' ,
80- arguments: ['Post ' ],
81- result: 'RonasIT \\Support \\Tests \\Support \\Command \\Models \\Post ' ,
82- ),
83- ]);
84-
8541 $ this ->mockClass (NovaTestGenerator::class, [
86- $ this ->functionCall (
87- name: 'getModelClass ' ,
88- arguments: ['Post ' ],
89- result: 'RonasIT \\Support \\Tests \\Support \\Command \\Models \\Post ' ,
90- ),
91- $ this ->functionCall (
92- name: 'getModelClass ' ,
93- arguments: ['Post ' ],
94- result: 'RonasIT \\Support \\Tests \\Support \\Command \\Models \\Post ' ,
95- ),
96- $ this ->functionCall (
97- name: 'getModelClass ' ,
98- arguments: ['Post ' ],
99- result: 'RonasIT \\Support \\Tests \\Support \\Command \\Models \\Post ' ,
100- ),
101- $ this ->functionCall (
102- name: 'getModelClass ' ,
103- arguments: ['Post ' ],
104- result: 'RonasIT \\Support \\Tests \\Support \\Command \\Models \\Post ' ,
105- ),
10642 $ this ->functionCall (
10743 name: 'loadNovaActions ' ,
10844 result: [],
0 commit comments