/** * Test for JForm::getErrors method. * * @return void */ public function testGetErrors() { $form = new JFormInspector('form1'); $this->assertThat($form->load(JFormDataHelper::$validateDocument), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.'); $fail = array('boolean' => 'comply', 'required' => ''); $this->assertThat($form->validate($fail), $this->isFalse(), 'Line:' . __LINE__ . ' Validating this data should fail.'); $errors = $form->getErrors($fail); $this->assertThat(count($errors), $this->equalTo(3), 'Line:' . __LINE__ . ' This data should invoke 3 errors.'); $this->assertThat($errors[0] instanceof Exception, $this->isTrue(), 'Line:' . __LINE__ . ' The errors should be exception objects.'); }