public function testClass() { $model = new User(); $this->assertFalse($model->isValid()); $this->assertTrue($model->hasErrors()); $this->assertTrue($model->hasErrors('username')); $this->assertEquals(['username' => ['Cannot be empty', 'Minimal length is 3']], $model->getErrors()); $this->assertEquals(['Cannot be empty', 'Minimal length is 3'], $model->getErrors('username')); $model->clearErrors('username'); $this->assertEquals([], $model->getErrors()); }