Skip to content

Commit

Permalink
Add test to cover nested fields in listing tables
Browse files Browse the repository at this point in the history
  • Loading branch information
duncanmcclean committed Jul 26, 2023
1 parent d39ea1f commit e5771ff
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/Http/Controllers/ResourceListingControllerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,4 +166,26 @@ public function can_paginate_results()
],
]);
}

/**
* @test
* https://github.com/duncanmcclean/runway/pull/223
*/
public function can_get_values_from_nested_fields()
{
$user = User::make()->makeSuper()->save();

$posts = $this->postFactory(3, [
'values' => [
'alt_title' => $this->faker()->words(6, true),
],
]);

$this->actingAs($user)
->get(cp_route('runway.listing-api', ['resourceHandle' => 'post']) . '?columns=title,values->alt_title')
->assertOk()
->assertSee($posts[0]->values['alt_title'])
->assertSee($posts[1]->values['alt_title'])
->assertSee($posts[2]->values['alt_title']);
}
}

0 comments on commit e5771ff

Please sign in to comment.