where('TestSiteCode', 'GLU')->where('EndDate IS NULL')->first(); if (!$test) { $test = $model->where('TestType', 'TEST')->where('EndDate IS NULL')->first(); } $this->assertNotEmpty($test, 'No active technical test record found for show endpoint test.'); $response = $this->call('get', 'api/test/' . $test['TestSiteID']); $response->assertStatus(200); $json = json_decode($response->getJSON(), true); $this->assertSame('success', $json['status'] ?? null); $this->assertArrayHasKey('data', $json); $this->assertArrayNotHasKey('testdeftech', $json['data']); $this->assertArrayHasKey('TestSiteID', $json['data']); $this->assertArrayHasKey('ResultType', $json['data']); } }