⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.19
Server IP:
178.33.27.10
Server:
Linux cpanel.dev-unit.com 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
Server Software:
Apache/2.4.57 (Unix) OpenSSL/1.0.2k-fips
PHP Version:
8.2.11
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
home
/
id
/
crm.dev-unit.com
/
tests
/
View File Name :
ApiTestTrait.php
<?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]); } } }