Skip to content

Commit 757c2f3

Browse files
author
Greg Bowler
committed
fix: dynamic url doesn't mind which order assemblies are in
1 parent 5bad687 commit 757c2f3

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/Path/DynamicPath.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function getUrl(string $viewBasePath):string {
6262
continue;
6363
}
6464

65-
break;
65+
break(2);
6666
}
6767
}
6868

test/phpunit/Path/DynamicPathTest.php

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,25 @@ public function testGet_noKey_shouldReturnDeepest():void {
5959
}
6060

6161
public function testGetUrl():void {
62-
$assembly = self::createMock(Assembly::class);
63-
$assembly->method("current")
62+
$viewAssembly = self::createMock(Assembly::class);
63+
$viewAssembly->method("current")
6464
->willReturnOnConsecutiveCalls(
6565
"page/_header.html",
6666
"page/_footer.html",
6767
"page/shop/@category/@itemName.html",
6868
);
69-
$assembly->method("valid")
69+
$viewAssembly->method("valid")
7070
->willReturn(true);
71-
$sut = new DynamicPath("/shop/OnePlus/6T", $assembly);
71+
$logicAssembly = self::createMock(Assembly::class);
72+
$logicAssembly->method("current")
73+
->willReturnOnConsecutiveCalls(
74+
"page/_common.php",
75+
"page/shop/_common.php",
76+
"page/shop/@category/@itemName.php",
77+
);
78+
$logicAssembly->method("valid")
79+
->willReturn(true);
80+
$sut = new DynamicPath("/shop/OnePlus/6T", $viewAssembly, $logicAssembly);
7281
self::assertSame("/shop/@category/@itemName", $sut->getUrl("page/"));
7382
}
7483
}

0 commit comments

Comments
 (0)