![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/clinic.corals.io/tests/ |
<?php namespace Tests; trait ApiTestTrait { private $response; public function assertApiResponse(Array $actualData) { $this->assertApiSuccess(); $response = json_decode($this->response->getContent(), true); $responseData = $response['data']; $this->assertNotEmpty($responseData['id']); $this->assertModelData($actualData, $responseData); } public function assertApiSuccess() { $this->response->assertStatus(200); $this->response->assertJson(['success' => true]); } public function assertModelData(Array $actualData, Array $expectedData) { foreach ($actualData as $key => $value) { if (in_array($key, ['created_at', 'updated_at'])) { continue; } $this->assertEquals($actualData[$key], $expectedData[$key]); } } }