File tree Expand file tree Collapse file tree 3 files changed +5
-21
lines changed Expand file tree Collapse file tree 3 files changed +5
-21
lines changed Original file line number Diff line number Diff line change 22
33namespace RonasIT \Support \Tests ;
44
5- use Illuminate \Support \Facades \Event ;
65use RonasIT \Support \Events \SuccessCreateMessage ;
76use RonasIT \Support \Events \WarningEvent ;
87use RonasIT \Support \Exceptions \ClassAlreadyExistsException ;
@@ -15,16 +14,11 @@ class ModelGeneratorTest extends TestCase
1514{
1615 use ModelMockTrait, MockTrait;
1716
18- public function setUp (): void
19- {
20- parent ::setUp ();
21-
22- Event::fake ();
23- }
24-
2517 public function testModelAlreadyExists ()
2618 {
27- $ this ->mockGeneratorForExistingModel ();
19+ $ this ->mockClass (ModelGenerator::class, [
20+ $ this ->classExistsMethodCall (['models ' , 'Post ' ]),
21+ ]);
2822
2923 $ this ->assertExceptionThrew (
3024 className: ClassAlreadyExistsException::class,
Original file line number Diff line number Diff line change 33namespace RonasIT \Support \Tests \Support \Model ;
44
55use org \bovigo \vfs \vfsStream ;
6- use RonasIT \Support \Generators \ModelGenerator ;
76use RonasIT \Support \Tests \Support \GeneratorMockTrait ;
87
98trait ModelMockTrait
109{
1110 use GeneratorMockTrait;
1211
13- public function mockGeneratorForExistingModel (): void
14- {
15- $ this ->mockClass (ModelGenerator::class, [
16- [
17- 'function ' => 'classExists ' ,
18- 'arguments ' => ['models ' , 'Post ' ],
19- 'result ' => true ,
20- ],
21- ]);
22- }
23-
2412 public function mockFilesystem (): void
2513 {
2614 $ structure = [
Original file line number Diff line number Diff line change @@ -28,6 +28,8 @@ public function setUp(): void
2828
2929 vfsStream::setup ();
3030
31+ Event::fake ();
32+
3133 $ this ->generatedFileBasePath = vfsStream::url ('root ' );
3234
3335 $ this ->app ->setBasePath ($ this ->generatedFileBasePath );
You can’t perform that action at this time.
0 commit comments