Skip to content

Commit

Permalink
Update routes for TaxonValueUrlGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkrz committed Dec 12, 2024
1 parent 98dafbc commit 0d52469
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions lib/Item/ValueUrlGenerator/TaxonValueUrlGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct(private readonly UrlGeneratorInterface $urlGenerator
public function generateDefaultUrl(object $object): ?string
{
return $this->urlGenerator->generate(
'sylius_shop_taxon_show',
'sylius_shop_partial_taxon_show_by_slug',
[
'slug' => $object->getSlug(),
],
Expand All @@ -27,7 +27,7 @@ public function generateDefaultUrl(object $object): ?string
public function generateAdminUrl(object $object): ?string
{
return $this->urlGenerator->generate(
'sylius_admin_taxon_show',
'sylius_admin_taxon_update',
[
'id' => $object->getId(),
],
Expand Down
18 changes: 9 additions & 9 deletions tests/lib/Item/ValueUrlGenerator/TaxonValueUrlGeneratorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ public function testGenerateDefaultUrl(): void
->expects(self::once())
->method('generate')
->with(
self::identicalTo('sylius_shop_taxon_show'),
self::identicalTo('sylius_shop_partial_taxon_show_by_slug'),
self::identicalTo(['slug' => 'taxon-name']),
)
->willReturn('/taxons/taxon-name');
->willReturn('/_partial/taxons/by-slug/taxon-name');

self::assertSame(
'/taxons/taxon-name',
'/_partial/taxons/by-slug/taxon-name',
$this->urlGenerator->generateDefaultUrl(new Taxon(42, 'Taxon name', 'taxon-name')),
);
}
Expand All @@ -48,13 +48,13 @@ public function testGenerateAdminUrl(): void
->expects(self::once())
->method('generate')
->with(
self::identicalTo('sylius_admin_taxon_show'),
self::identicalTo('sylius_admin_taxon_update'),
self::identicalTo(['id' => 42]),
)
->willReturn('/admin/taxons/42');
->willReturn('/admin/taxons/42/edit');

self::assertSame(
'/admin/taxons/42',
'/admin/taxons/42/edit',
$this->urlGenerator->generateAdminUrl(new Taxon(42, 'Taxon name', 'taxon-name')),
);
}
Expand All @@ -65,13 +65,13 @@ public function testGenerate(): void
->expects(self::once())
->method('generate')
->with(
self::identicalTo('sylius_shop_taxon_show'),
self::identicalTo('sylius_shop_partial_taxon_show_by_slug'),
self::identicalTo(['slug' => 'taxon-name']),
)
->willReturn('/taxons/taxon-name');
->willReturn('/_partial/taxons/by-slug/taxon-name');

self::assertSame(
'/taxons/taxon-name',
'/_partial/taxons/by-slug/taxon-name',
$this->urlGenerator->generate(new Taxon(42, 'Taxon name', 'taxon-name')),
);
}
Expand Down

0 comments on commit 0d52469

Please sign in to comment.