|
4 | 4 | use Code16\Sharp\Exceptions\SharpInvalidBreadcrumbItemException; |
5 | 5 | use Code16\Sharp\Filters\SelectFilter; |
6 | 6 | use Code16\Sharp\Tests\Fixtures\Entities\PersonEntity; |
| 7 | +use Code16\Sharp\Tests\Fixtures\Entities\PersonPhysicistEntity; |
7 | 8 | use Code16\Sharp\Utils\Links\BreadcrumbBuilder; |
8 | 9 | use Code16\Sharp\Utils\Links\LinkToDashboard; |
9 | 10 | use Code16\Sharp\Utils\Links\LinkToEntityList; |
|
28 | 29 | ); |
29 | 30 | }); |
30 | 31 |
|
| 32 | +it('allows to generate a link to a form with another key for the list', function () { |
| 33 | + $this->assertEquals( |
| 34 | + '<a href="http://localhost/sharp/s-list/my-list-entity/s-form/my-entity/23" title="">test</a>', |
| 35 | + LinkToForm::make('my-entity', 23) |
| 36 | + ->withListEntityKey('my-list-entity') |
| 37 | + ->renderAsText('test'), |
| 38 | + ); |
| 39 | +}); |
| 40 | + |
31 | 41 | it('allows to generate a link to a form through a show page', function () { |
32 | 42 | $this->assertEquals( |
33 | 43 | '<a href="http://localhost/sharp/s-list/my-entity/s-show/my-entity/23/s-form/my-entity/23" title="">test</a>', |
|
37 | 47 | ); |
38 | 48 | }); |
39 | 49 |
|
| 50 | +it('allows to generate a link to a form through a show page with another key for the list', function () { |
| 51 | + $this->assertEquals( |
| 52 | + '<a href="http://localhost/sharp/s-list/my-list-entity/s-show/my-entity/23/s-form/my-entity/23" title="">test</a>', |
| 53 | + LinkToForm::make('my-entity', 23) |
| 54 | + ->withListEntityKey('my-list-entity') |
| 55 | + ->throughShowPage() |
| 56 | + ->renderAsText('test'), |
| 57 | + ); |
| 58 | +}); |
| 59 | + |
40 | 60 | it('allows to generate a link to a show page', function () { |
41 | 61 | $this->assertEquals( |
42 | 62 | '<a href="http://localhost/sharp/s-list/my-entity/s-show/my-entity/23" title="">test</a>', |
|
45 | 65 | ); |
46 | 66 | }); |
47 | 67 |
|
| 68 | +it('allows to generate a link to a show page with another key for the list', function () { |
| 69 | + $this->assertEquals( |
| 70 | + '<a href="http://localhost/sharp/s-list/my-list-entity/s-show/my-entity/23" title="">test</a>', |
| 71 | + LinkToShowPage::make('my-entity', 23) |
| 72 | + ->withListEntityKey('my-list-entity') |
| 73 | + ->renderAsText('test'), |
| 74 | + ); |
| 75 | +}); |
| 76 | + |
48 | 77 | it('allows to generate a link to a single show page', function () { |
49 | 78 | $this->assertEquals( |
50 | 79 | '<a href="http://localhost/sharp/s-show/my-entity" title="">test</a>', |
|
71 | 100 | ); |
72 | 101 | }); |
73 | 102 |
|
| 103 | +it('allows to generate a link to a show page with another key for the list passing SharpEntity classes', function () { |
| 104 | + app(SharpConfigBuilder::class) |
| 105 | + ->declareEntity(PersonEntity::class) |
| 106 | + ->declareEntity(PersonPhysicistEntity::class); |
| 107 | + |
| 108 | + $this->assertEquals( |
| 109 | + '<a href="http://localhost/sharp/s-list/person/s-show/person-physicist/23" title="">test</a>', |
| 110 | + LinkToShowPage::make(PersonPhysicistEntity::class, 23) |
| 111 | + ->withListEntityKey(PersonEntity::class) |
| 112 | + ->renderAsText('test'), |
| 113 | + ); |
| 114 | +}); |
| 115 | + |
74 | 116 | it('allows to generate an url to a show page with a specific breadcrumb', function () { |
75 | 117 | $this->assertEquals( |
76 | 118 | 'http://localhost/sharp/s-list/base-entity/s-show/base-entity/3/s-show/my-entity/4', |
|
0 commit comments