Skip to content

Commit

Permalink
Bug Fix: Duplicate src in file path
Browse files Browse the repository at this point in the history
- Fixes #101
- Added a test for the same feature
  • Loading branch information
coolsam726 committed Apr 24, 2024
1 parent 1ff98bc commit 87f9147
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Concerns/GeneratesModularFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ protected function getArguments(): array

protected function resolveStubPath($stub): string
{
return FilamentModules::packagePath('src/Commands/' . trim($stub, DIRECTORY_SEPARATOR));
return FilamentModules::packagePath('Commands/' . trim($stub, DIRECTORY_SEPARATOR));
}

public function getModule(): Module
Expand Down
25 changes: 25 additions & 0 deletions tests/Unit/GeneratesModularFilesConcernTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

// Setup for all tests
beforeEach(function () {
$this->trait = new class extends \Illuminate\Console\Command
{
use Coolsam\Modules\Concerns\GeneratesModularFiles;

public function getRelativeNamespace(): string
{
return 'Commands';
}

public function getStub()
{
return $this->resolveStubPath('stubs/filament-plugin.stub');
}
};
});

test('can generate the correct stubs path', function () {
// include the GeneratesModularFiles trait
expect($this->trait->getStub())
->toEqual(realpath(__DIR__.'/../../src/Commands/stubs/filament-plugin.stub'));
});

0 comments on commit 87f9147

Please sign in to comment.