public function testShouldCheckIfItIsInvalidWhenItIs() { $category = new Category(); $category->name = 'Category test'; $validator = m::mock(Validator::class); $validator->shouldReceive('setRules')->with(['name' => 'required|max:255']); $validator->shouldReceive('setData')->with(['name' => 'Category test']); $validator->shouldReceive('fails')->andReturn(false); $category->setValidator($validator); $this->assertTrue($category->isValid()); }