Skip to content

Commit

Permalink
Normalize path expectation.
Browse files Browse the repository at this point in the history
  • Loading branch information
JasperTey committed Nov 17, 2024
1 parent e45a2c2 commit 18ca89b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions tests/Expectations.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
return $this->toContain(Path::normalize($path));
});

expect()->extend('toEqualPath', function ($path) {
return $this->toEqual(Path::normalize($path));
});

expect()->extend('toGenerateFileWithNamespace', function ($expectedPath, $expectedNamespace) {
$command = $this->value;

Expand Down
8 changes: 4 additions & 4 deletions tests/Support/BlueprintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
->name->toBe($expectedName)
->namespace->toBe($expectedNamespace)
->fullyQualifiedName->toBe($expectedFqn)
->path->toBe($expectedPath);
->path->toEqualPath($expectedPath);
})->with([
['ddd:controller', 'SomeDomain', 'ApplicationController', 'ApplicationController', 'Application\\SomeDomain\\Controllers', 'Application\\SomeDomain\\Controllers\\ApplicationController', 'src/Application/SomeDomain/Controllers/ApplicationController.php'],
['ddd:controller', 'SomeDomain', 'Application', 'Application', 'Application\\SomeDomain\\Controllers', 'Application\\SomeDomain\\Controllers\\Application', 'src/Application/SomeDomain/Controllers/Application.php'],
Expand All @@ -68,7 +68,7 @@
->name->toBe($expectedName)
->namespace->toBe($expectedNamespace)
->fullyQualifiedName->toBe($expectedFqn)
->path->toBe($expectedPath);
->path->toEqualPath($expectedPath);
})->with([
['ddd:model', 'Infrastructure', 'System', 'System', 'Infrastructure\\Models', 'Infrastructure\\Models\\System', 'src/Infrastructure/Models/System.php'],
['ddd:factory', 'Infrastructure', 'System', 'SystemFactory', 'Infrastructure\\Database\\Factories', 'Infrastructure\\Database\\Factories\\SystemFactory', 'src/Infrastructure/Database/Factories/SystemFactory.php'],
Expand All @@ -90,7 +90,7 @@
->name->toBe($expectedName)
->namespace->toBe($expectedNamespace)
->fullyQualifiedName->toBe($expectedFqn)
->path->toBe($expectedPath);
->path->toEqualPath($expectedPath);
})->with([
['ddd:model', 'SomeDomain', 'SomeDomain', 'SomeDomain', 'Domain\\SomeDomain\\Models', 'Domain\\SomeDomain\\Models\\SomeDomain', 'src/Domain/SomeDomain/Models/SomeDomain.php'],
['ddd:model', 'SomeDomain', 'SomeDomainModel', 'SomeDomainModel', 'Domain\\SomeDomain\\Models', 'Domain\\SomeDomain\\Models\\SomeDomainModel', 'src/Domain/SomeDomain/Models/SomeDomainModel.php'],
Expand All @@ -115,7 +115,7 @@
->name->toBe($expectedName)
->namespace->toBe($expectedNamespace)
->fullyQualifiedName->toBe($expectedFqn)
->path->toBe($expectedPath);
->path->toEqualPath($expectedPath);
})->with([
['ddd:model', 'SomeDomain', '/RootModel', 'RootModel', 'Domain\\SomeDomain', 'Domain\\SomeDomain\\RootModel', 'src/Domain/SomeDomain/RootModel.php'],
['ddd:model', 'SomeDomain', '/CustomLocation/Thing', 'CustomLocation\\Thing', 'Domain\\SomeDomain', 'Domain\\SomeDomain\\CustomLocation\\Thing', 'src/Domain/SomeDomain/CustomLocation/Thing.php'],
Expand Down

0 comments on commit 18ca89b

Please sign in to comment.