From 18ca89bcb26baec4c285a07a1af7157d7768f529 Mon Sep 17 00:00:00 2001 From: Jasper Tey Date: Sat, 16 Nov 2024 20:12:52 -0500 Subject: [PATCH] Normalize path expectation. --- tests/Expectations.php | 4 ++++ tests/Support/BlueprintTest.php | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/tests/Expectations.php b/tests/Expectations.php index f2cdd6d..8e4d405 100644 --- a/tests/Expectations.php +++ b/tests/Expectations.php @@ -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; diff --git a/tests/Support/BlueprintTest.php b/tests/Support/BlueprintTest.php index a633b79..23b72c0 100644 --- a/tests/Support/BlueprintTest.php +++ b/tests/Support/BlueprintTest.php @@ -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'], @@ -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'], @@ -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'], @@ -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'],