/** * Test for JForm::setFieldAttribute method. * * @return void */ public function testSetFieldAttribute() { $form = new JFormInspector('form1'); $this->assertThat($form->load(JFormDataHelper::$loadDocument), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.'); $this->assertThat($form->setFieldAttribute('title', 'label', 'The Title'), $this->isTrue(), 'Line:' . __LINE__ . ' The method should return true.'); $this->assertThat($form->getFieldAttribute('title', 'label'), $this->equalTo('The Title'), 'Line:' . __LINE__ . ' The new value should be set.'); $this->assertThat($form->setFieldAttribute('show_title', 'label', 'Show Title', 'params'), $this->isTrue(), 'Line:' . __LINE__ . ' The method should return true.'); $this->assertThat($form->getFieldAttribute('show_title', 'label', 'default', 'params'), $this->equalTo('Show Title'), 'Line:' . __LINE__ . ' The new value of the grouped field should be set.'); }