Tests for company update

This commit is contained in:
David Bomba 2023-01-18 07:46:34 +11:00
parent 5e67916117
commit 8ec20f4a78

View File

@ -47,6 +47,42 @@ class CompanyTest extends TestCase
$this->makeTestData();
}
public function testUpdateCompanyPropertyInvoiceTaskHours()
{
$company_update = [
'invoice_task_hours' => true
];
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->putJson('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $company_update)
->assertStatus(200);
$arr = $response->json();
$this->assertTrue($arr['data']['invoice_task_hours']);
$company_update = [
'invoice_task_hours' => false
];
$response = $this->withHeaders([
'X-API-SECRET' => config('ninja.api_secret'),
'X-API-TOKEN' => $this->token,
])->putJson('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $company_update)
->assertStatus(200);
$arr = $response->json();
$this->assertFalse($arr['data']['invoice_task_hours']);
}
public function testCompanyList()
{
$this->withoutMiddleware(PasswordProtection::class);