Skip to content

Commit

Permalink
MakeFactory::getPath() wasn't normalized
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperTey committed Mar 11, 2024
1 parent 60b0e0d commit 98da7da
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/Commands/MakeFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Lunarstorm\LaravelDDD\Commands;

use Lunarstorm\LaravelDDD\Support\Domain;
use Lunarstorm\LaravelDDD\Support\Path;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputOption;

Expand Down Expand Up @@ -74,7 +75,7 @@ protected function getPath($name)
->append('.php')
->toString();

return base_path('database/factories/'.$name);
return Path::normalize(base_path('database/factories/'.$name));
}

protected function getFactoryName()
Expand Down
3 changes: 2 additions & 1 deletion tests/Generator/MakeFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Str;
use Lunarstorm\LaravelDDD\Support\Domain;
use Lunarstorm\LaravelDDD\Support\Path;
use Lunarstorm\LaravelDDD\Tests\Fixtures\Enums\Feature;

it('can generate domain factories', function ($domainPath, $domainRoot, $domain, $subdomain) {
Expand All @@ -23,7 +24,7 @@

$domainFactory = $domain->factory($factoryName);

$expectedFactoryPath = base_path($domainFactory->path);
$expectedFactoryPath = Path::normalize(base_path($domainFactory->path));

if (file_exists($expectedFactoryPath)) {
unlink($expectedFactoryPath);
Expand Down

0 comments on commit 98da7da

Please sign in to comment.