Skip to content

Commit 0950926

Browse files
committed
refactor: replace hardcoded route with constant in HasManyDeepRelationTest
1 parent 2046d9e commit 0950926

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/Integration/HasManyDeepRelationTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ class HasManyDeepRelationTest extends TestCase
1212
{
1313
use DatabaseTransactions;
1414

15+
private const ROUTE_HAS_MANY_DEEP = '/relations/hasManyDeep';
16+
1517
#[Test]
1618
public function it_returns_all_records_with_the_relation_when_called_without_parameters()
1719
{
18-
$response = $this->call('GET', '/relations/hasManyDeep');
20+
$response = $this->call('GET', self::ROUTE_HAS_MANY_DEEP);
1921
$response->assertJson([
2022
'draw' => 0,
2123
'recordsTotal' => 20,
@@ -73,7 +75,7 @@ public function it_can_perform_global_search_on_the_relation()
7375
#[Test]
7476
public function it_can_order_by_has_many_deep_relation_column()
7577
{
76-
$response = $this->call('GET', '/relations/hasManyDeep', [
78+
$response = $this->call('GET', self::ROUTE_HAS_MANY_DEEP, [
7779
'columns' => [
7880
['data' => 'comments.content', 'name' => 'comments.content', 'searchable' => true, 'orderable' => true],
7981
['data' => 'name', 'name' => 'name', 'searchable' => true, 'orderable' => true],
@@ -105,14 +107,14 @@ protected function getJsonResponse(array $params = [])
105107
],
106108
];
107109

108-
return $this->call('GET', '/relations/hasManyDeep', array_merge($data, $params));
110+
return $this->call('GET', self::ROUTE_HAS_MANY_DEEP, array_merge($data, $params));
109111
}
110112

111113
protected function setUp(): void
112114
{
113115
parent::setUp();
114116

115-
$this->app['router']->get('/relations/hasManyDeep', fn (DataTables $datatables) => $datatables->eloquent(User::with('comments')->select('users.*'))->toJson());
117+
$this->app['router']->get(self::ROUTE_HAS_MANY_DEEP, fn (DataTables $datatables) => $datatables->eloquent(User::with('comments')->select('users.*'))->toJson());
116118

117119
$this->app['router']->get('/relations/hasManyDeepSearchRelation', fn (DataTables $datatables) => $datatables->eloquent(User::with('comments'))->toJson());
118120
}

0 commit comments

Comments
 (0)