makeTestData(); Session::start(); $this->faker = \Faker\Factory::create(); Model::reguard(); } public function testClientNumberCantBeModified() { $settings = $this->company->settings; $settings->client_number_counter = 200; $this->company->settings = $settings; $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-Token' => $this->token, ])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray()); $response->assertStatus(200); $arr = $response->json(); $this->assertEquals($arr['data']['settings']['timezone_id'],15); } public function testSettingCasts() { $settings = $this->company->settings; $settings->client_number_counter = "a"; $settings->invoice_number_counter = 1000; $this->company->settings = $settings; $response = $this->withHeaders([ 'X-API-SECRET' => config('ninja.api_secret'), 'X-API-Token' => $this->token, ])->put('/api/v1/companies/'.$this->encodePrimaryKey($this->company->id), $this->company->toArray()); $response->assertStatus(200); $arr = $response->json(); \Log::error($arr); $this->assertEquals($arr['data']['settings']['client_number_counter'],1); $this->assertEquals($arr['data']['settings']['invoice_number_counter'],1000); } }