| @@ 17-69 (lines=53) @@ | ||
| 14 | * |
|
| 15 | * @since 1.0 |
|
| 16 | */ |
|
| 17 | class JFormFieldEmailTest extends \PHPUnit_Framework_TestCase |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * Sets up dependencies for the test. |
|
| 21 | * |
|
| 22 | * @return void |
|
| 23 | * |
|
| 24 | * @since 1.0 |
|
| 25 | */ |
|
| 26 | protected function setUp() |
|
| 27 | { |
|
| 28 | // The real class cannot be autoloaded |
|
| 29 | \Joomla\Form\FormHelper::loadFieldClass('email'); |
|
| 30 | ||
| 31 | parent::setUp(); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * Test the getInput method. |
|
| 36 | * |
|
| 37 | * @return void |
|
| 38 | * |
|
| 39 | * @since 1.0 |
|
| 40 | */ |
|
| 41 | public function testGetInput() |
|
| 42 | { |
|
| 43 | $form = new JFormInspector('form1'); |
|
| 44 | ||
| 45 | $this->assertThat( |
|
| 46 | $form->load('<form><field name="email" type="email" /></form>'), |
|
| 47 | $this->isTrue(), |
|
| 48 | 'Line:' . __LINE__ . ' XML string should load successfully.' |
|
| 49 | ); |
|
| 50 | ||
| 51 | /** @var Field_Email $field */ |
|
| 52 | $field = \Joomla\Form\FormHelper::loadFieldType('email'); |
|
| 53 | $field->setForm($form); |
|
| 54 | ||
| 55 | $this->assertThat( |
|
| 56 | $field->setup($form->getXml()->field, 'value'), |
|
| 57 | $this->isTrue(), |
|
| 58 | 'Line:' . __LINE__ . ' The setup method should return true.' |
|
| 59 | ); |
|
| 60 | ||
| 61 | $this->assertThat( |
|
| 62 | strlen($field->input), |
|
| 63 | $this->greaterThan(0), |
|
| 64 | 'Line:' . __LINE__ . ' The getInput method should return something without error.' |
|
| 65 | ); |
|
| 66 | ||
| 67 | // TODO: Should check all the attributes have come in properly. |
|
| 68 | } |
|
| 69 | } |
|
| 70 | ||
| @@ 17-69 (lines=53) @@ | ||
| 14 | * |
|
| 15 | * @since 1.0 |
|
| 16 | */ |
|
| 17 | class JFormFieldFileListTest extends \PHPUnit_Framework_TestCase |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * Sets up dependencies for the test. |
|
| 21 | * |
|
| 22 | * @return void |
|
| 23 | * |
|
| 24 | * @since 1.0 |
|
| 25 | */ |
|
| 26 | protected function setUp() |
|
| 27 | { |
|
| 28 | // The real class cannot be autoloaded |
|
| 29 | \Joomla\Form\FormHelper::loadFieldClass('fileList'); |
|
| 30 | ||
| 31 | parent::setUp(); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * Test the getInput method. |
|
| 36 | * |
|
| 37 | * @return void |
|
| 38 | * |
|
| 39 | * @since 1.0 |
|
| 40 | */ |
|
| 41 | public function testGetInput() |
|
| 42 | { |
|
| 43 | $form = new JFormInspector('form1'); |
|
| 44 | ||
| 45 | $this->assertThat( |
|
| 46 | $form->load('<form><field name="filelist" type="filelist" /></form>'), |
|
| 47 | $this->isTrue(), |
|
| 48 | 'Line:' . __LINE__ . ' XML string should load successfully.' |
|
| 49 | ); |
|
| 50 | ||
| 51 | /** @var Field_FileList $field */ |
|
| 52 | $field = \Joomla\Form\FormHelper::loadFieldType('fileList'); |
|
| 53 | $field->setForm($form); |
|
| 54 | ||
| 55 | $this->assertThat( |
|
| 56 | $field->setup($form->getXml()->field, 'value'), |
|
| 57 | $this->isTrue(), |
|
| 58 | 'Line:' . __LINE__ . ' The setup method should return true.' |
|
| 59 | ); |
|
| 60 | ||
| 61 | $this->assertThat( |
|
| 62 | strlen($field->input), |
|
| 63 | $this->greaterThan(0), |
|
| 64 | 'Line:' . __LINE__ . ' The getInput method should return something without error.' |
|
| 65 | ); |
|
| 66 | ||
| 67 | // TODO: Should check all the attributes have come in properly. |
|
| 68 | } |
|
| 69 | } |
|
| 70 | ||
| @@ 17-65 (lines=49) @@ | ||
| 14 | * |
|
| 15 | * @since 1.0 |
|
| 16 | */ |
|
| 17 | class JFormFieldFileTest extends \PHPUnit_Framework_TestCase |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * Sets up dependancies for the test. |
|
| 21 | * |
|
| 22 | * @return void |
|
| 23 | */ |
|
| 24 | protected function setUp() |
|
| 25 | { |
|
| 26 | // The real class cannot be autoloaded |
|
| 27 | \Joomla\Form\FormHelper::loadFieldClass('file'); |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * Test the getInput method. |
|
| 32 | * |
|
| 33 | * @return void |
|
| 34 | */ |
|
| 35 | public function testGetInput() |
|
| 36 | { |
|
| 37 | $form = new JFormInspector('form1'); |
|
| 38 | ||
| 39 | $this->assertThat( |
|
| 40 | $form->load('<form><field name="file" type="file" /></form>'), |
|
| 41 | $this->isTrue(), |
|
| 42 | 'Line:' . __LINE__ . ' XML string should load successfully.' |
|
| 43 | ); |
|
| 44 | ||
| 45 | /** @var Field_File $field */ |
|
| 46 | $field = \Joomla\Form\FormHelper::loadFieldType('file'); |
|
| 47 | $field->setForm($form); |
|
| 48 | ||
| 49 | $this->assertThat( |
|
| 50 | $field->setup($form->getXml()->field, 'value'), |
|
| 51 | $this->isTrue(), |
|
| 52 | 'Line:' . __LINE__ . ' The setup method should return true.' |
|
| 53 | ); |
|
| 54 | ||
| 55 | $this->markTestIncomplete('Problems encountered in next assertion'); |
|
| 56 | ||
| 57 | $this->assertThat( |
|
| 58 | strlen($field->input), |
|
| 59 | $this->greaterThan(0), |
|
| 60 | 'Line:' . __LINE__ . ' The getInput method should return something without error.' |
|
| 61 | ); |
|
| 62 | ||
| 63 | // TODO: Should check all the attributes have come in properly. |
|
| 64 | } |
|
| 65 | } |
|
| 66 | ||
| @@ 17-69 (lines=53) @@ | ||
| 14 | * |
|
| 15 | * @since 1.0 |
|
| 16 | */ |
|
| 17 | class JFormFieldFolderListTest extends \PHPUnit_Framework_TestCase |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * Sets up dependencies for the test. |
|
| 21 | * |
|
| 22 | * @return void |
|
| 23 | * |
|
| 24 | * @since 1.0 |
|
| 25 | */ |
|
| 26 | protected function setUp() |
|
| 27 | { |
|
| 28 | // The real class cannot be autoloaded |
|
| 29 | \Joomla\Form\FormHelper::loadFieldClass('folderList'); |
|
| 30 | ||
| 31 | parent::setUp(); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * Test the getInput method. |
|
| 36 | * |
|
| 37 | * @return void |
|
| 38 | * |
|
| 39 | * @since 1.0 |
|
| 40 | */ |
|
| 41 | public function testGetInput() |
|
| 42 | { |
|
| 43 | $form = new JFormInspector('form1'); |
|
| 44 | ||
| 45 | $this->assertThat( |
|
| 46 | $form->load('<form><field name="folderlist" type="folderlist" /></form>'), |
|
| 47 | $this->isTrue(), |
|
| 48 | 'Line:' . __LINE__ . ' XML string should load successfully.' |
|
| 49 | ); |
|
| 50 | ||
| 51 | /** @var Field_FolderList $field */ |
|
| 52 | $field = \Joomla\Form\FormHelper::loadFieldType('folderList'); |
|
| 53 | $field->setForm($form); |
|
| 54 | ||
| 55 | $this->assertThat( |
|
| 56 | $field->setup($form->getXml()->field, 'value'), |
|
| 57 | $this->isTrue(), |
|
| 58 | 'Line:' . __LINE__ . ' The setup method should return true.' |
|
| 59 | ); |
|
| 60 | ||
| 61 | $this->assertThat( |
|
| 62 | strlen($field->input), |
|
| 63 | $this->greaterThan(0), |
|
| 64 | 'Line:' . __LINE__ . ' The getInput method should return something without error.' |
|
| 65 | ); |
|
| 66 | ||
| 67 | // TODO: Should check all the attributes have come in properly. |
|
| 68 | } |
|
| 69 | } |
|
| 70 | ||
| @@ 17-67 (lines=51) @@ | ||
| 14 | * |
|
| 15 | * @since 1.0 |
|
| 16 | */ |
|
| 17 | class JFormFieldGroupedListTest extends \PHPUnit_Framework_TestCase |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * Sets up dependencies for the test. |
|
| 21 | * |
|
| 22 | * @return void |
|
| 23 | * |
|
| 24 | * @since 1.0 |
|
| 25 | */ |
|
| 26 | protected function setUp() |
|
| 27 | { |
|
| 28 | // The real class cannot be autoloaded |
|
| 29 | \Joomla\Form\FormHelper::loadFieldClass('groupedList'); |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * Test the getInput method. |
|
| 34 | * |
|
| 35 | * @return void |
|
| 36 | * |
|
| 37 | * @since 1.0 |
|
| 38 | */ |
|
| 39 | public function testGetInput() |
|
| 40 | { |
|
| 41 | $form = new JFormInspector('form1'); |
|
| 42 | ||
| 43 | $this->assertThat( |
|
| 44 | $form->load('<form><field name="groupedlist" type="groupedlist" /></form>'), |
|
| 45 | $this->isTrue(), |
|
| 46 | 'Line:' . __LINE__ . ' XML string should load successfully.' |
|
| 47 | ); |
|
| 48 | ||
| 49 | /** @var Field_GroupedList $field */ |
|
| 50 | $field = \Joomla\Form\FormHelper::loadFieldType('groupedList'); |
|
| 51 | $field->setForm($form); |
|
| 52 | ||
| 53 | $this->assertThat( |
|
| 54 | $field->setup($form->getXml()->field, 'value'), |
|
| 55 | $this->isTrue(), |
|
| 56 | 'Line:' . __LINE__ . ' The setup method should return true.' |
|
| 57 | ); |
|
| 58 | ||
| 59 | $this->assertThat( |
|
| 60 | strlen($field->input), |
|
| 61 | $this->greaterThan(0), |
|
| 62 | 'Line:' . __LINE__ . ' The getInput method should return something without error.' |
|
| 63 | ); |
|
| 64 | ||
| 65 | // TODO: Should check all the attributes have come in properly. |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||
| @@ 17-69 (lines=53) @@ | ||
| 14 | * |
|
| 15 | * @since 1.0 |
|
| 16 | */ |
|
| 17 | class JFormFieldImageListTest extends \PHPUnit_Framework_TestCase |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * Sets up dependencies for the test. |
|
| 21 | * |
|
| 22 | * @return void |
|
| 23 | * |
|
| 24 | * @since 1.0 |
|
| 25 | */ |
|
| 26 | protected function setUp() |
|
| 27 | { |
|
| 28 | // The real class cannot be autoloaded |
|
| 29 | \Joomla\Form\FormHelper::loadFieldClass('imageList'); |
|
| 30 | ||
| 31 | parent::setUp(); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * Test the getInput method. |
|
| 36 | * |
|
| 37 | * @return void |
|
| 38 | * |
|
| 39 | * @since 1.0 |
|
| 40 | */ |
|
| 41 | public function testGetInput() |
|
| 42 | { |
|
| 43 | $form = new JFormInspector('form1'); |
|
| 44 | ||
| 45 | $this->assertThat( |
|
| 46 | $form->load('<form><field name="imagelist" type="imagelist" /></form>'), |
|
| 47 | $this->isTrue(), |
|
| 48 | 'Line:' . __LINE__ . ' XML string should load successfully.' |
|
| 49 | ); |
|
| 50 | ||
| 51 | /** @var Field_ImageList $field */ |
|
| 52 | $field = \Joomla\Form\FormHelper::loadFieldType('imageList'); |
|
| 53 | $field->setForm($form); |
|
| 54 | ||
| 55 | $this->assertThat( |
|
| 56 | $field->setup($form->getXml()->field, 'value'), |
|
| 57 | $this->isTrue(), |
|
| 58 | 'Line:' . __LINE__ . ' The setup method should return true.' |
|
| 59 | ); |
|
| 60 | ||
| 61 | $this->assertThat( |
|
| 62 | strlen($field->input), |
|
| 63 | $this->greaterThan(0), |
|
| 64 | 'Line:' . __LINE__ . ' The getInput method should return something without error.' |
|
| 65 | ); |
|
| 66 | ||
| 67 | // TODO: Should check all the attributes have come in properly. |
|
| 68 | } |
|
| 69 | } |
|
| 70 | ||
| @@ 17-65 (lines=49) @@ | ||
| 14 | * |
|
| 15 | * @since 1.0 |
|
| 16 | */ |
|
| 17 | class JFormFieldListTest extends \PHPUnit_Framework_TestCase |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * Sets up dependancies for the test. |
|
| 21 | * |
|
| 22 | * @return void |
|
| 23 | */ |
|
| 24 | protected function setUp() |
|
| 25 | { |
|
| 26 | // The real class cannot be autoloaded |
|
| 27 | \Joomla\Form\FormHelper::loadFieldClass('list'); |
|
| 28 | ||
| 29 | parent::setUp(); |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * Test the getInput method. |
|
| 34 | * |
|
| 35 | * @return void |
|
| 36 | */ |
|
| 37 | public function testGetInput() |
|
| 38 | { |
|
| 39 | $form = new JFormInspector('form1'); |
|
| 40 | ||
| 41 | $this->assertThat( |
|
| 42 | $form->load('<form><field name="list" type="list" /></form>'), |
|
| 43 | $this->isTrue(), |
|
| 44 | 'Line:' . __LINE__ . ' XML string should load successfully.' |
|
| 45 | ); |
|
| 46 | ||
| 47 | /** @var Field_List $field */ |
|
| 48 | $field = \Joomla\Form\FormHelper::loadFieldType('list'); |
|
| 49 | $field->setForm($form); |
|
| 50 | ||
| 51 | $this->assertThat( |
|
| 52 | $field->setup($form->getXml()->field, 'value'), |
|
| 53 | $this->isTrue(), |
|
| 54 | 'Line:' . __LINE__ . ' The setup method should return true.' |
|
| 55 | ); |
|
| 56 | ||
| 57 | $this->assertThat( |
|
| 58 | strlen($field->input), |
|
| 59 | $this->greaterThan(0), |
|
| 60 | 'Line:' . __LINE__ . ' The getInput method should return something without error.' |
|
| 61 | ); |
|
| 62 | ||
| 63 | // TODO: Should check all the attributes have come in properly. |
|
| 64 | } |
|
| 65 | } |
|
| 66 | ||
| @@ 17-63 (lines=47) @@ | ||
| 14 | * |
|
| 15 | * @since 1.0 |
|
| 16 | */ |
|
| 17 | class JFormFieldPasswordTest extends \PHPUnit_Framework_TestCase |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * Sets up dependancies for the test. |
|
| 21 | * |
|
| 22 | * @return void |
|
| 23 | */ |
|
| 24 | protected function setUp() |
|
| 25 | { |
|
| 26 | // The real class cannot be autoloaded |
|
| 27 | \Joomla\Form\FormHelper::loadFieldClass('password'); |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * Test the getInput method. |
|
| 32 | * |
|
| 33 | * @return void |
|
| 34 | */ |
|
| 35 | public function testGetInput() |
|
| 36 | { |
|
| 37 | $form = new JFormInspector('form1'); |
|
| 38 | ||
| 39 | $this->assertThat( |
|
| 40 | $form->load('<form><field name="password" type="password" /></form>'), |
|
| 41 | $this->isTrue(), |
|
| 42 | 'Line:' . __LINE__ . ' XML string should load successfully.' |
|
| 43 | ); |
|
| 44 | ||
| 45 | /** @var Field_Password $field */ |
|
| 46 | $field = \Joomla\Form\FormHelper::loadFieldType('password'); |
|
| 47 | $field->setForm($form); |
|
| 48 | ||
| 49 | $this->assertThat( |
|
| 50 | $field->setup($form->getXml()->field, 'value'), |
|
| 51 | $this->isTrue(), |
|
| 52 | 'Line:' . __LINE__ . ' The setup method should return true.' |
|
| 53 | ); |
|
| 54 | ||
| 55 | $this->assertThat( |
|
| 56 | strlen($field->input), |
|
| 57 | $this->greaterThan(0), |
|
| 58 | 'Line:' . __LINE__ . ' The getInput method should return something without error.' |
|
| 59 | ); |
|
| 60 | ||
| 61 | // TODO: Should check all the attributes have come in properly. |
|
| 62 | } |
|
| 63 | } |
|
| 64 | ||
| @@ 17-69 (lines=53) @@ | ||
| 14 | * |
|
| 15 | * @since 1.0 |
|
| 16 | */ |
|
| 17 | class JFormFieldTelTest extends \PHPUnit_Framework_TestCase |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * Sets up dependencies for the test. |
|
| 21 | * |
|
| 22 | * @return void |
|
| 23 | * |
|
| 24 | * @since 1.0 |
|
| 25 | */ |
|
| 26 | protected function setUp() |
|
| 27 | { |
|
| 28 | // The real class cannot be autoloaded |
|
| 29 | \Joomla\Form\FormHelper::loadFieldClass('tel'); |
|
| 30 | ||
| 31 | parent::setUp(); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * Test the getInput method. |
|
| 36 | * |
|
| 37 | * @return void |
|
| 38 | * |
|
| 39 | * @since 1.0 |
|
| 40 | */ |
|
| 41 | public function testGetInput() |
|
| 42 | { |
|
| 43 | $form = new JFormInspector('form1'); |
|
| 44 | ||
| 45 | $this->assertThat( |
|
| 46 | $form->load('<form><field name="tel" type="tel" /></form>'), |
|
| 47 | $this->isTrue(), |
|
| 48 | 'Line:' . __LINE__ . ' XML string should load successfully.' |
|
| 49 | ); |
|
| 50 | ||
| 51 | /** @var Field_Tel $field */ |
|
| 52 | $field = \Joomla\Form\FormHelper::loadFieldType('tel'); |
|
| 53 | $field->setForm($form); |
|
| 54 | ||
| 55 | $this->assertThat( |
|
| 56 | $field->setup($form->getXml()->field, 'value'), |
|
| 57 | $this->isTrue(), |
|
| 58 | 'Line:' . __LINE__ . ' The setup method should return true.' |
|
| 59 | ); |
|
| 60 | ||
| 61 | $this->assertThat( |
|
| 62 | strlen($field->input), |
|
| 63 | $this->greaterThan(0), |
|
| 64 | 'Line:' . __LINE__ . ' The getInput method should return something without error.' |
|
| 65 | ); |
|
| 66 | ||
| 67 | // TODO: Should check all the attributes have come in properly. |
|
| 68 | } |
|
| 69 | } |
|
| 70 | ||
| @@ 17-65 (lines=49) @@ | ||
| 14 | * |
|
| 15 | * @since 1.0 |
|
| 16 | */ |
|
| 17 | class JFormFieldTextareaTest extends \PHPUnit_Framework_TestCase |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * Sets up dependancies for the test. |
|
| 21 | * |
|
| 22 | * @return void |
|
| 23 | */ |
|
| 24 | protected function setUp() |
|
| 25 | { |
|
| 26 | // The real class cannot be autoloaded |
|
| 27 | \Joomla\Form\FormHelper::loadFieldClass('textarea'); |
|
| 28 | ||
| 29 | parent::setUp(); |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * Test the getInput method. |
|
| 34 | * |
|
| 35 | * @return void |
|
| 36 | */ |
|
| 37 | public function testGetInput() |
|
| 38 | { |
|
| 39 | $form = new JFormInspector('form1'); |
|
| 40 | ||
| 41 | $this->assertThat( |
|
| 42 | $form->load('<form><field name="textarea" type="textarea" /></form>'), |
|
| 43 | $this->isTrue(), |
|
| 44 | 'Line:' . __LINE__ . ' XML string should load successfully.' |
|
| 45 | ); |
|
| 46 | ||
| 47 | /** @var Field_Textarea $field */ |
|
| 48 | $field = \Joomla\Form\FormHelper::loadFieldType('textarea'); |
|
| 49 | $field->setForm($form); |
|
| 50 | ||
| 51 | $this->assertThat( |
|
| 52 | $field->setup($form->getXml()->field, 'value'), |
|
| 53 | $this->isTrue(), |
|
| 54 | 'Line:' . __LINE__ . ' The setup method should return true.' |
|
| 55 | ); |
|
| 56 | ||
| 57 | $this->assertThat( |
|
| 58 | strlen($field->input), |
|
| 59 | $this->greaterThan(0), |
|
| 60 | 'Line:' . __LINE__ . ' The getInput method should return something without error.' |
|
| 61 | ); |
|
| 62 | ||
| 63 | // TODO: Should check all the attributes have come in properly. |
|
| 64 | } |
|
| 65 | } |
|
| 66 | ||
| @@ 17-65 (lines=49) @@ | ||
| 14 | * |
|
| 15 | * @since 1.0 |
|
| 16 | */ |
|
| 17 | class JFormFieldTextTest extends \PHPUnit_Framework_TestCase |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * Sets up dependancies for the test. |
|
| 21 | * |
|
| 22 | * @return void |
|
| 23 | */ |
|
| 24 | protected function setUp() |
|
| 25 | { |
|
| 26 | // The real class cannot be autoloaded |
|
| 27 | \Joomla\Form\FormHelper::loadFieldClass('text'); |
|
| 28 | ||
| 29 | parent::setUp(); |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * Test the getInput method. |
|
| 34 | * |
|
| 35 | * @return void |
|
| 36 | */ |
|
| 37 | public function testGetInput() |
|
| 38 | { |
|
| 39 | $form = new JFormInspector('form1'); |
|
| 40 | ||
| 41 | $this->assertThat( |
|
| 42 | $form->load('<form><field name="text" type="text" /></form>'), |
|
| 43 | $this->isTrue(), |
|
| 44 | 'Line:' . __LINE__ . ' XML string should load successfully.' |
|
| 45 | ); |
|
| 46 | ||
| 47 | /** @var Field_Text $field */ |
|
| 48 | $field = \Joomla\Form\FormHelper::loadFieldType('text'); |
|
| 49 | $field->setForm($form); |
|
| 50 | ||
| 51 | $this->assertThat( |
|
| 52 | $field->setup($form->getXml()->field, 'value'), |
|
| 53 | $this->isTrue(), |
|
| 54 | 'Line:' . __LINE__ . ' The setup method should return true.' |
|
| 55 | ); |
|
| 56 | ||
| 57 | $this->assertThat( |
|
| 58 | strlen($field->input), |
|
| 59 | $this->greaterThan(0), |
|
| 60 | 'Line:' . __LINE__ . ' The getInput method should return something without error.' |
|
| 61 | ); |
|
| 62 | ||
| 63 | // TODO: Should check all the attributes have come in properly. |
|
| 64 | } |
|
| 65 | } |
|
| 66 | ||
| @@ 17-67 (lines=51) @@ | ||
| 14 | * |
|
| 15 | * @since 1.0 |
|
| 16 | */ |
|
| 17 | class JFormFieldTimezoneTest extends \PHPUnit_Framework_TestCase |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * Sets up dependancies for the test. |
|
| 21 | * |
|
| 22 | * @return void |
|
| 23 | */ |
|
| 24 | protected function setUp() |
|
| 25 | { |
|
| 26 | // The real class cannot be autoloaded |
|
| 27 | \Joomla\Form\FormHelper::loadFieldClass('timezone'); |
|
| 28 | ||
| 29 | parent::setUp(); |
|
| 30 | } |
|
| 31 | ||
| 32 | /** |
|
| 33 | * Test the getInput method. |
|
| 34 | * |
|
| 35 | * @return void |
|
| 36 | */ |
|
| 37 | public function testGetInput() |
|
| 38 | { |
|
| 39 | $form = new JFormInspector('form1'); |
|
| 40 | ||
| 41 | $this->assertThat( |
|
| 42 | $form->load('<form><field name="timezone" type="timezone" /></form>'), |
|
| 43 | $this->isTrue(), |
|
| 44 | 'Line:' . __LINE__ . ' XML string should load successfully.' |
|
| 45 | ); |
|
| 46 | ||
| 47 | /** @var Field_Timezone $field */ |
|
| 48 | $field = \Joomla\Form\FormHelper::loadFieldType('timezone'); |
|
| 49 | $field->setForm($form); |
|
| 50 | ||
| 51 | $this->assertThat( |
|
| 52 | $field->setup($form->getXml()->field, 'value'), |
|
| 53 | $this->isTrue(), |
|
| 54 | 'Line:' . __LINE__ . ' The setup method should return true.' |
|
| 55 | ); |
|
| 56 | ||
| 57 | $this->markTestIncomplete('Problems encountered in next assertion'); |
|
| 58 | ||
| 59 | $this->assertThat( |
|
| 60 | strlen($field->input), |
|
| 61 | $this->greaterThan(0), |
|
| 62 | 'Line:' . __LINE__ . ' The getInput method should return something without error.' |
|
| 63 | ); |
|
| 64 | ||
| 65 | // TODO: Should check all the attributes have come in properly. |
|
| 66 | } |
|
| 67 | } |
|
| 68 | ||
| @@ 17-69 (lines=53) @@ | ||
| 14 | * |
|
| 15 | * @since 1.0 |
|
| 16 | */ |
|
| 17 | class JFormFieldUrlTest extends \PHPUnit_Framework_TestCase |
|
| 18 | { |
|
| 19 | /** |
|
| 20 | * Sets up dependencies for the test. |
|
| 21 | * |
|
| 22 | * @return void |
|
| 23 | * |
|
| 24 | * @since 1.0 |
|
| 25 | */ |
|
| 26 | protected function setUp() |
|
| 27 | { |
|
| 28 | // The real class cannot be autoloaded |
|
| 29 | \Joomla\Form\FormHelper::loadFieldClass('url'); |
|
| 30 | ||
| 31 | parent::setUp(); |
|
| 32 | } |
|
| 33 | ||
| 34 | /** |
|
| 35 | * Test the getInput method. |
|
| 36 | * |
|
| 37 | * @return void |
|
| 38 | * |
|
| 39 | * @since 1.0 |
|
| 40 | */ |
|
| 41 | public function testGetInput() |
|
| 42 | { |
|
| 43 | $form = new JFormInspector('form1'); |
|
| 44 | ||
| 45 | $this->assertThat( |
|
| 46 | $form->load('<form><field name="url" type="url" /></form>'), |
|
| 47 | $this->isTrue(), |
|
| 48 | 'Line:' . __LINE__ . ' XML string should load successfully.' |
|
| 49 | ); |
|
| 50 | ||
| 51 | /** @var Field_Url $field */ |
|
| 52 | $field = \Joomla\Form\FormHelper::loadFieldType('url'); |
|
| 53 | $field->setForm($form); |
|
| 54 | ||
| 55 | $this->assertThat( |
|
| 56 | $field->setup($form->getXml()->field, 'value'), |
|
| 57 | $this->isTrue(), |
|
| 58 | 'Line:' . __LINE__ . ' The setup method should return true.' |
|
| 59 | ); |
|
| 60 | ||
| 61 | $this->assertThat( |
|
| 62 | strlen($field->input), |
|
| 63 | $this->greaterThan(0), |
|
| 64 | 'Line:' . __LINE__ . ' The getInput method should return something without error.' |
|
| 65 | ); |
|
| 66 | ||
| 67 | // TODO: Should check all the attributes have come in properly. |
|
| 68 | } |
|
| 69 | } |
|
| 70 | ||