Skip to content

Commit 40fdcb2

Browse files
committed
refactor: tests
refs: #49
1 parent 4943946 commit 40fdcb2

File tree

3 files changed

+9
-13
lines changed

3 files changed

+9
-13
lines changed

src/Generators/RepositoryGenerator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function generate(): void
1212
if (!$this->classExists('models', $this->model)) {
1313
$this->throwFailureException(
1414
ClassNotExistsException::class,
15-
"Cannot create {$this->model} Model cause {$this->model} Model does not exists.",
15+
"Cannot create {$this->model}Repository cause {$this->model} Model does not exists.",
1616
"Create a {$this->model} Model by himself or run command 'php artisan make:entity {$this->model} --only-model'."
1717
);
1818
}

tests/RepositoryGeneratorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function testModelNotExist()
2020

2121
$this->assertExceptionThrew(
2222
className: ClassNotExistsException::class,
23-
message: "Cannot create Post Model cause Post Model does not exists. "
23+
message: "Cannot create PostRepository cause Post Model does not exists. "
2424
. "Create a Post Model by himself or run command 'php artisan make:entity Post --only-model'.",
2525
);
2626

tests/Support/Repository/RepositoryMockTrait.php

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,21 @@
22

33
namespace RonasIT\Support\Tests\Support\Repository;
44

5-
use org\bovigo\vfs\vfsStream;
5+
use RonasIT\Support\Tests\Support\FileSystemMock;
66
use RonasIT\Support\Tests\Support\GeneratorMockTrait;
7-
use RonasIT\Support\Traits\MockTrait;
87

98
trait RepositoryMockTrait
109
{
11-
use GeneratorMockTrait, MockTrait;
10+
use GeneratorMockTrait;
1211

1312
public function mockFilesystem(): void
1413
{
15-
$structure = [
16-
'app' => [
17-
'Models' => [
18-
'Post.php' => '<?php',
19-
],
20-
'Repositories' => [],
21-
],
14+
$fileSystemMock = new FileSystemMock;
15+
16+
$fileSystemMock->models = [
17+
'Post.php' => $this->mockPhpFileContent(),
2218
];
2319

24-
vfsStream::create($structure);
20+
$fileSystemMock->setStructure();
2521
}
2622
}

0 commit comments

Comments
 (0)