/** * Test the getInput method. * * @return void */ public function testGetInput() { $form = new JFormInspector('form1'); $this->assertThat($form->load('<form><field name="calendar" type="calendar" /></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.'); $field = new JFormFieldCalendar($form); $this->assertThat($field->setup($form->getXml()->field, 'value'), $this->isTrue(), 'Line:' . __LINE__ . ' The setup method should return true.'); $this->markTestIncomplete('Problems encountered in next assertion'); $this->assertThat(strlen($field->input), $this->greaterThan(0), 'Line:' . __LINE__ . ' The getInput method should return something without error.'); // TODO: Should check all the attributes have come in properly. }
/** * Test the getInput method. * * @return void */ public function testGetInputWithStringValue() { $form = new JForm('form1'); $this->assertThat($form->load('<form><field name="calendar" type="calendar" /></form>'), $this->isTrue(), 'Line:' . __LINE__ . ' XML string should load successfully.'); // The calendar form field depends on having the time zone available. Easiest way is to // mock it in the config $testConfig = $this->getMockConfig(); $testConfig->expects($this->any())->method('get')->will($this->returnValue('Europe/London')); JFactory::$config = $testConfig; $field = new JFormFieldCalendar($form); $this->assertThat($field->setup($form->getXml()->field, 'June 2015'), $this->isTrue(), 'Line:' . __LINE__ . ' The setup method should return true.'); $this->assertThat(strlen($field->input), $this->greaterThan(0), 'Line:' . __LINE__ . ' The getInput method should return something without error.'); // TODO: Should check all the attributes have come in properly. }