File tree Expand file tree Collapse file tree 8 files changed +49
-39
lines changed
NovaResourceGeneratorTest Expand file tree Collapse file tree 8 files changed +49
-39
lines changed Original file line number Diff line number Diff line change @@ -11,22 +11,26 @@ trait ControllerGeneratorMockTrait
1111
1212 public function mockFilesystemWithoutRoutesFile (): void
1313 {
14- $ this ->fileSystemMock ->routes = [];
14+ $ fileSystemMock = new FileSystemMock ;
15+ $ fileSystemMock ->services = [
16+ 'PostService.php ' => $ this ->mockPhpFileContent (),
17+ ];
18+ $ fileSystemMock ->controllers = [];
1519
16- $ this -> fileSystemMock ->setStructure ();
20+ $ fileSystemMock ->setStructure ();
1721 }
1822
1923 public function mockFilesystem (): void
2024 {
21- $ this -> fileSystemMock = new FileSystemMock ;
22- $ this -> fileSystemMock ->services = [
25+ $ fileSystemMock = new FileSystemMock ;
26+ $ fileSystemMock ->services = [
2327 'PostService.php ' => $ this ->mockPhpFileContent (),
2428 ];
25- $ this -> fileSystemMock ->controllers = [];
26- $ this -> fileSystemMock ->routes = [
29+ $ fileSystemMock ->controllers = [];
30+ $ fileSystemMock ->routes = [
2731 'api.php ' => $ this ->mockPhpFileContent (),
2832 ];
2933
30- $ this -> fileSystemMock ->setStructure ();
34+ $ fileSystemMock ->setStructure ();
3135 }
3236}
Original file line number Diff line number Diff line change @@ -17,22 +17,24 @@ public function mockFactoryGenerator(array ...$functionCalls): void
1717
1818 public function mockFileSystemWithoutPostModel (): void
1919 {
20- $ this ->fileSystemMock ->models = [
20+ $ fileSystemMock = new FileSystemMock ();
21+
22+ $ fileSystemMock ->models = [
2123 'User.php ' => $ this ->mockPhpFileContent (),
2224 ];
2325
24- $ this -> fileSystemMock ->setStructure ();
26+ $ fileSystemMock ->setStructure ();
2527 }
2628
2729 public function mockFilesystem (): void
2830 {
29- $ this -> fileSystemMock = new FileSystemMock ();
31+ $ fileSystemMock = new FileSystemMock ();
3032
31- $ this -> fileSystemMock ->models = [
33+ $ fileSystemMock ->models = [
3234 'Post.php ' => $ this ->mockPhpFileContent (),
3335 'User.php ' => $ this ->mockPhpFileContent (),
3436 ];
3537
36- $ this -> fileSystemMock ->setStructure ();
38+ $ fileSystemMock ->setStructure ();
3739 }
3840}
Original file line number Diff line number Diff line change @@ -9,8 +9,6 @@ trait GeneratorMockTrait
99{
1010 use MockTrait;
1111
12- protected FileSystemMock $ fileSystemMock ;
13-
1412 public function mockNativeGeneratorFunctions (...$ functionCalls ): void
1513 {
1614 $ this ->mockNativeFunction ('\RonasIT\Support\Generators ' , $ functionCalls );
Original file line number Diff line number Diff line change @@ -12,22 +12,24 @@ trait ModelMockTrait
1212
1313 public function mockFileSystemWithoutCommentModel (): void
1414 {
15- $ this ->fileSystemMock ->models = [
15+ $ fileSystemMock = new FileSystemMock ;
16+
17+ $ fileSystemMock ->models = [
1618 'User.php ' => file_get_contents (getcwd () . '/tests/Support/Models/WelcomeBonus.php ' ),
1719 ];
1820
19- $ this -> fileSystemMock ->setStructure ();
21+ $ fileSystemMock ->setStructure ();
2022 }
2123
2224 public function mockFilesystem (): void
2325 {
24- $ this -> fileSystemMock = new FileSystemMock ;
26+ $ fileSystemMock = new FileSystemMock ;
2527
26- $ this -> fileSystemMock ->models = [
28+ $ fileSystemMock ->models = [
2729 'Comment.php ' => file_get_contents (getcwd () . '/tests/Support/Models/WelcomeBonus.php ' ),
2830 'User.php ' => file_get_contents (getcwd () . '/tests/Support/Models/WelcomeBonus.php ' ),
2931 ];
3032
31- $ this -> fileSystemMock ->setStructure ();
33+ $ fileSystemMock ->setStructure ();
3234 }
3335}
Original file line number Diff line number Diff line change @@ -14,13 +14,13 @@ trait NovaResourceGeneratorMockTrait
1414
1515 public function mockFilesystem (): void
1616 {
17- $ this -> fileSystemMock = new FileSystemMock ;
18- $ this -> fileSystemMock ->novaModels = [];
19- $ this -> fileSystemMock ->models = [
17+ $ fileSystemMock = new FileSystemMock ;
18+ $ fileSystemMock ->novaModels = [];
19+ $ fileSystemMock ->models = [
2020 'Post.php ' => $ this ->mockPhpFileContent (),
2121 ];
2222
23- $ this -> fileSystemMock ->setStructure ();
23+ $ fileSystemMock ->setStructure ();
2424 }
2525
2626 public function mockGettingModelInstance (): void
@@ -41,8 +41,10 @@ public function mockGettingModelInstance(): void
4141
4242 public function mockFileSystemWithoutPostModel (): void
4343 {
44- $ this -> fileSystemMock -> models = null ;
44+ $ fileSystemMock = new FileSystemMock ;
4545
46- $ this ->fileSystemMock ->setStructure ();
46+ $ fileSystemMock ->models = null ;
47+
48+ $ fileSystemMock ->setStructure ();
4749 }
4850}
Original file line number Diff line number Diff line change @@ -19,27 +19,27 @@ public function mockNovaRequestClassCall(): void
1919
2020 public function mockFilesystem (): void
2121 {
22- $ this -> fileSystemMock = new FileSystemMock ;
22+ $ fileSystemMock = new FileSystemMock ;
2323
24- $ this -> fileSystemMock ->novaActions = [
24+ $ fileSystemMock ->novaActions = [
2525 'PublishPostAction.php ' => $ this ->mockPhpFileContent (),
2626 'ArchivePostAction.php ' => $ this ->mockPhpFileContent (),
2727 'BlockCommentAction.php ' => $ this ->mockPhpFileContent (),
2828 'UnPublishPostAction.txt ' => 'text ' ,
2929 ];
3030
31- $ this -> fileSystemMock ->novaModels = [
31+ $ fileSystemMock ->novaModels = [
3232 'WelcomeBonusResource.php ' => $ this ->mockPhpFileContent (),
3333 ];
3434
35- $ this -> fileSystemMock ->models = [
35+ $ fileSystemMock ->models = [
3636 'WelcomeBonus.php ' => $ this ->mockPhpFileContent (),
3737 ];
3838
39- $ this -> fileSystemMock ->testFixtures = [
39+ $ fileSystemMock ->testFixtures = [
4040 'NovaWelcomeBonusTest ' => []
4141 ];
4242
43- $ this -> fileSystemMock ->setStructure ();
43+ $ fileSystemMock ->setStructure ();
4444 }
4545}
Original file line number Diff line number Diff line change @@ -11,12 +11,12 @@ trait RepositoryMockTrait
1111
1212 public function mockFilesystem (): void
1313 {
14- $ this -> fileSystemMock = new FileSystemMock ;
14+ $ fileSystemMock = new FileSystemMock ;
1515
16- $ this -> fileSystemMock ->models = [
16+ $ fileSystemMock ->models = [
1717 'Post.php ' => $ this ->mockPhpFileContent (),
1818 ];
1919
20- $ this -> fileSystemMock ->setStructure ();
20+ $ fileSystemMock ->setStructure ();
2121 }
2222}
Original file line number Diff line number Diff line change @@ -11,19 +11,21 @@ trait TranslationMockTrait
1111
1212 public function mockFilesystem (): void
1313 {
14- $ this -> fileSystemMock = new FileSystemMock ();
14+ $ fileSystemMock = new FileSystemMock ();
1515
16- $ this -> fileSystemMock ->translations = [];
16+ $ fileSystemMock ->translations = [];
1717
18- $ this -> fileSystemMock ->setStructure ();
18+ $ fileSystemMock ->setStructure ();
1919 }
2020
2121 public function mockFilesystemForAppend (): void
2222 {
2323 $ validation = file_get_contents (getcwd () . '/tests/Support/Translation/validation_without_exceptions.php ' );
2424
25- $ this -> fileSystemMock -> translations = [ ' validation.php ' => $ validation ] ;
25+ $ fileSystemMock = new FileSystemMock () ;
2626
27- $ this ->fileSystemMock ->setStructure ();
27+ $ fileSystemMock ->translations = ['validation.php ' => $ validation ];
28+
29+ $ fileSystemMock ->setStructure ();
2830 }
2931}
You can’t perform that action at this time.
0 commit comments