Conditions | 1 |
Paths | 1 |
Total Lines | 28 |
Lines | 28 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
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 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.