Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement make repository command #17

Merged
merged 4 commits into from
Mar 17, 2024
Merged

implement make repository command #17

merged 4 commits into from
Mar 17, 2024

Conversation

salehhashemi1992
Copy link
Owner

@salehhashemi1992 salehhashemi1992 commented Mar 7, 2024

add php artisan make:repository command

@salehhashemi1992 salehhashemi1992 force-pushed the stub branch 2 times, most recently from 4b83b23 to cf7301a Compare March 7, 2024 15:47
Copy link

codecov bot commented Mar 7, 2024

Codecov Report

Attention: Patch coverage is 97.87234% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 93.95%. Comparing base (f67e5f0) to head (9db1955).

Files Patch % Lines
src/Commands/MakeRepository.php 97.67% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main      #17      +/-   ##
============================================
+ Coverage     92.85%   93.95%   +1.09%     
- Complexity       58       69      +11     
============================================
  Files             4        5       +1     
  Lines           168      215      +47     
============================================
+ Hits            156      202      +46     
- Misses           12       13       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@salehhashemi1992 salehhashemi1992 self-assigned this Mar 7, 2024
@salehhashemi1992 salehhashemi1992 added the enhancement New feature or request label Mar 7, 2024
@salehhashemi1992 salehhashemi1992 force-pushed the stub branch 2 times, most recently from f2814b4 to 655be4d Compare March 8, 2024 11:23
tests/MakeRepositoryCommandTest.php Outdated Show resolved Hide resolved
tests/MakeRepositoryCommandTest.php Outdated Show resolved Hide resolved
src/Contracts/RepositoryInterface.php Outdated Show resolved Hide resolved
src/Commands/stubs/repository.stub Outdated Show resolved Hide resolved
src/Commands/stubs/filter.stub Outdated Show resolved Hide resolved
src/Commands/MakeRepository.php Outdated Show resolved Hide resolved
src/Commands/MakeRepository.php Show resolved Hide resolved
@salehhashemi1992 salehhashemi1992 force-pushed the stub branch 2 times, most recently from 0c14494 to 081f9a8 Compare March 13, 2024 10:09
src/Commands/MakeRepository.php Outdated Show resolved Hide resolved
src/Commands/MakeRepository.php Outdated Show resolved Hide resolved
@imahmood
Copy link
Collaborator

It seems there's an extra backslash in the namespace declaration and use statements.

    /**
     * Assert the correct namespace in generated files
     */
    public function testHasCorrectNamespace(): void
    {
        $fqcn = 'App\Models\Special\\'.$this->model;

        $this->artisan('make:repository', ['name' => $fqcn]);

        $expectedNamespace = 'namespace App\Repositories';
        $expectedFiles = [
            "{$this->basePath}/{$this->model}Repository.php",
            "{$this->basePath}/Contracts/{$this->model}RepositoryInterface.php",
            "{$this->basePath}/Filters/{$this->model}Filter.php",
        ];

        foreach ($expectedFiles as $file) {
            $this->assertStringContainsString($expectedNamespace, file_get_contents($file));
        }
    }

@salehhashemi1992 salehhashemi1992 merged commit 0347582 into main Mar 17, 2024
12 checks passed
@salehhashemi1992 salehhashemi1992 deleted the stub branch March 17, 2024 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants