public function testClosure() { $model = new Product(); $model->setAttributes(['name' => '12']); $this->assertFalse($model->isValid()); $this->assertTrue($model->hasErrors()); $this->assertTrue($model->hasErrors('name')); $this->assertEquals(['name' => ['Minimal length < 3']], $model->getErrors()); $this->assertEquals(['Minimal length < 3'], $model->getErrors('name')); $model->clearErrors('name'); $this->assertEquals([], $model->getErrors()); }