Improve readability

This commit is contained in:
Marcus Moore 2023-12-21 12:15:00 -08:00
parent 5c0c60a5b9
commit 2eeaef00e1
No known key found for this signature in database

View file

@ -87,33 +87,25 @@ class ReportTemplateTest extends TestCase
public function testSelectValuesDoNotIncludeDeletedOrNonExistentModels() public function testSelectValuesDoNotIncludeDeletedOrNonExistentModels()
{ {
[$locationA, $locationB] = Location::factory()->count(2)->create(); [$locationA, $locationB] = Location::factory()->count(2)->create();
$invalidId = 10000;
$savedReport = ReportTemplate::factory()->create([ $savedReport = ReportTemplate::factory()->create([
'options' => [ 'options' => [
'by_location_id' => [ 'by_location_id' => [
$locationA->id, $locationA->id,
$locationB->id, $locationB->id,
10000 $invalidId,
], ],
], ],
]); ]);
$locationB->delete(); $locationB->delete();
$this->assertContains( $parsedValues = $savedReport->selectValues('by_location_id', Location::class);
$locationA->id,
$savedReport->selectValues('by_location_id', Location::class)
);
$this->assertNotContains( $this->assertContains($locationA->id, $parsedValues);
$locationB->id, $this->assertNotContains($locationB->id, $parsedValues);
$savedReport->selectValues('by_location_id', Location::class) $this->assertNotContains($invalidId, $parsedValues);
);
$this->assertNotContains(
10000,
$savedReport->selectValues('by_location_id', Location::class)
);
} }
public function testGracefullyHandlesSingleSelectBecomingMultiSelect() public function testGracefullyHandlesSingleSelectBecomingMultiSelect()