Skip to content

Commit

Permalink
Add test for hyphenated names
Browse files Browse the repository at this point in the history
  • Loading branch information
inxilpro committed Jan 6, 2023
1 parent e029bb8 commit b3abed2
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/ResourceRoutesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,46 @@ public function test_custom_names(bool $cache): void
);
}

/** @dataProvider cachingProvider */
public function test_hyphenated_names(bool $cache): void
{
Route::middleware(SubstituteBindings::class)
->group(function() {
Route::resource('jazzy-dancers', ResourceRoutesTestJazzyDancerController::class)
->breadcrumbs(fn(ResourceBreadcrumbs $breadcrumbs) => $breadcrumbs
->index('Jazzy Dancers')
->create('New Dancer')
->show(fn(User $jazzy_dancer) => $jazzy_dancer->name)
->edit('Edit'));
});

$this->setUpCache($cache);

$this->get(route('jazzy-dancers.index'));
$this->assertActiveBreadcrumbs(
['Jazzy Dancers', '/jazzy-dancers'],
);

$this->get(route('jazzy-dancers.create'));
$this->assertActiveBreadcrumbs(
['Jazzy Dancers', '/jazzy-dancers'],
['New Dancer', '/jazzy-dancers/create'],
);

$this->get(route('jazzy-dancers.show', $this->user));
$this->assertActiveBreadcrumbs(
['Jazzy Dancers', '/jazzy-dancers'],
[$this->user->name, route('jazzy-dancers.show', $this->user)],
);

$this->get(route('jazzy-dancers.edit', $this->user));
$this->assertActiveBreadcrumbs(
['Jazzy Dancers', '/jazzy-dancers'],
[$this->user->name, route('jazzy-dancers.show', $this->user)],
['Edit', route('jazzy-dancers.edit', $this->user)],
);
}

/** @dataProvider cachingProvider */
public function test_custom_parents(bool $cache): void
{
Expand Down

0 comments on commit b3abed2

Please sign in to comment.