Skip to content

Commit ed45f9f

Browse files
[5.x] Fix error from DefaultInvalidator when creating a nav (#13596)
1 parent c0071e4 commit ed45f9f

2 files changed

Lines changed: 3 additions & 11 deletions

File tree

src/StaticCaching/DefaultInvalidator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ protected function invalidateNavUrls($nav)
161161

162162
protected function invalidateNavTreeUrls($tree)
163163
{
164-
$rules = collect(Arr::get($this->rules, "navigation.{$tree->structure()->handle()}.urls"));
164+
$rules = collect(Arr::get($this->rules, "navigation.{$tree->handle()}.urls"));
165165

166166
$absoluteUrls = $rules->filter(fn (string $rule) => $this->isAbsoluteUrl($rule))->all();
167167

tests/StaticCaching/DefaultInvalidatorTest.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -559,12 +559,8 @@ public function navigation_urls_can_be_invalidated_by_a_tree()
559559
])->once();
560560
});
561561

562-
$nav = tap(Mockery::mock(Nav::class), function ($m) {
562+
$tree = tap(Mockery::mock(NavTree::class), function ($m) {
563563
$m->shouldReceive('handle')->andReturn('links');
564-
});
565-
566-
$tree = tap(Mockery::mock(NavTree::class), function ($m) use ($nav) {
567-
$m->shouldReceive('structure')->andReturn($nav);
568564
$m->shouldReceive('site')->andReturn(Site::default());
569565
});
570566

@@ -599,12 +595,8 @@ public function navigation_urls_can_be_invalidated_by_a_tree_in_a_multisite()
599595
])->once();
600596
});
601597

602-
$nav = tap(Mockery::mock(Nav::class), function ($m) {
598+
$tree = tap(Mockery::mock(NavTree::class), function ($m) {
603599
$m->shouldReceive('handle')->andReturn('links');
604-
});
605-
606-
$tree = tap(Mockery::mock(NavTree::class), function ($m) use ($nav) {
607-
$m->shouldReceive('structure')->andReturn($nav);
608600
$m->shouldReceive('site')->andReturn(Site::get('fr'));
609601
});
610602

0 commit comments

Comments
 (0)