withoutMiddleware( ThrottleRequests::class ); $this->makeTestData(); $this->withoutExceptionHandling(); } public function testValidEmailRule() { auth()->login($this->user); auth()->user()->setCompany($this->company); Invoice::factory()->create([ 'client_id' => $this->client->id, 'user_id' => $this->user->id, 'company_id' => $this->company->id, 'paid_to_date' => 100, 'status_id' => 4, 'date' => now(), 'due_date'=> now(), 'number' => 'db_record' ]); $data = [ 'client_id' => $this->client->hashed_id, 'paid_to_date' => 100, 'status_id' => 4, 'date' => now(), 'due_date'=> now(), 'number' => 'db_record' ]; $rules = (new StoreInvoiceRequest())->rules(); $validator = Validator::make($data, $rules); $this->assertFalse($validator->passes()); } }