• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

RonasIT / laravel-entity-generator / 12350519352

16 Dec 2024 10:17AM UTC coverage: 48.366%. Remained the same
12350519352

Pull #126

github

web-flow
Merge 90fa94bb7 into 100fe1d25
Pull Request #126: #125: Use model test states in tests generator

1 of 4 new or added lines in 3 files covered. (25.0%)

444 of 918 relevant lines covered (48.37%)

1.65 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/Generators/RepositoryGenerator.php
1
<?php
2

3
namespace RonasIT\Support\Generators;
4

5
use RonasIT\Support\Exceptions\ClassNotExistsException;
6
use RonasIT\Support\Events\SuccessCreateMessage;
7

8
class RepositoryGenerator extends EntityGenerator
9
{
10
    public function generate(): void
11
    {
12
        if (!$this->classExists('models', $this->model)) {
×
13
            $this->throwFailureException(
×
14
                ClassNotExistsException::class,
×
15
                "Cannot create {$this->model} Model cause {$this->model} Model does not exists.",
×
16
                "Create a {$this->model} Model by himself or run command 'php artisan make:entity {$this->model} --only-model'."
×
17
            );
×
18
        }
19

20
        if (!$this->isStubExists('repository')) {
×
21
            return;
×
22
        }
23

24
        $repositoryContent = $this->getStub('repository', [
×
25
            'entity' => $this->model,
×
26
            'namespace' => $this->getOrCreateNamespace('repositories'),
×
27
            'modelNamespace' => $this->getOrCreateNamespace('models')
×
28
        ]);
×
29

30
        $this->saveClass('repositories', "{$this->model}Repository", $repositoryContent);
×
31

32
        event(new SuccessCreateMessage("Created a new Repository: {$this->model}Repository"));
×
33
    }
34
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc