public function testFormValidationErrors() { $form = new Form(); $form->input('name')->addValidator((new Required())->setError('name input error')); $form->input('email')->addValidator((new Required())->setError('email input error')); $form->handle(new FormData('post', [$form->getUid() => 1])); $this->assertFalse($form->isValid()); $this->assertEquals(['name input error', 'email input error'], $form->getErrors()); $form->handle(new FormData('post', [$form->getUid() => 1, 'email' => '*****@*****.**'])); $this->assertFalse($form->isValid()); $this->assertEquals(['name input error'], $form->getErrors()); $form->handle(new FormData('post', [$form->getUid() => 1, 'name' => 'testName', 'email' => '*****@*****.**'])); $this->assertTrue($form->isValid()); $this->assertEquals([], $form->getErrors()); }