diff --git a/tests/Feature/CompanyTest.php b/tests/Feature/CompanyTest.php index 255d51bdff76..418321dc16bc 100644 --- a/tests/Feature/CompanyTest.php +++ b/tests/Feature/CompanyTest.php @@ -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);