Skip to content

Commit b9d4aa3

Browse files
committed
Merge remote-tracking branch 'origin/49-add-model-generator-tests' into 49-add-repository-generator-tests
2 parents 97931b2 + db624fc commit b9d4aa3

File tree

3 files changed

+5
-21
lines changed

3 files changed

+5
-21
lines changed

tests/ModelGeneratorTest.php

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace RonasIT\Support\Tests;
44

5-
use Illuminate\Support\Facades\Event;
65
use RonasIT\Support\Events\SuccessCreateMessage;
76
use RonasIT\Support\Events\WarningEvent;
87
use 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,

tests/Support/Model/ModelMockTrait.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,12 @@
33
namespace RonasIT\Support\Tests\Support\Model;
44

55
use org\bovigo\vfs\vfsStream;
6-
use RonasIT\Support\Generators\ModelGenerator;
76
use RonasIT\Support\Tests\Support\GeneratorMockTrait;
87

98
trait 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 = [

tests/TestCase.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)