| Conditions | 1 | 
| Paths | 1 | 
| Total Lines | 68 | 
| Code Lines | 41 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
| 1 | <?php  | 
            ||
| 76 | public function testValidationOfNestedConditionalRequiredFields()  | 
            ||
| 77 |     { | 
            ||
| 78 | $page = $this->objFromFixture(UserDefinedForm::class, 'required-nested-custom-rules-form');  | 
            ||
| 79 | $this->assertEquals(4, $page->Fields()->count());  | 
            ||
| 80 | $validator = $this->getValidatorFromPage($page);  | 
            ||
| 81 | $this->assertNotNull($validator);  | 
            ||
| 82 | |||
| 83 | $this->assertFalse($validator->php([]),  | 
            ||
| 84 | 'Fails when non-conditional required field is empty');  | 
            ||
| 85 | |||
| 86 | $this->assertTrue(  | 
            ||
| 87 | $validator->php(  | 
            ||
| 88 | [  | 
            ||
| 89 | 'required-text-field-3' => 'some text',  | 
            ||
| 90 | 'radio-option-2' => 'N',  | 
            ||
| 91 | 'conditional-required-text-2' => '',  | 
            ||
| 92 | 'conditional-required-text-3' => ''  | 
            ||
| 93 | ]  | 
            ||
| 94 | ),  | 
            ||
| 95 | 'Passes when non-conditional required field has a value'  | 
            ||
| 96 | );  | 
            ||
| 97 | |||
| 98 | $this->assertFalse(  | 
            ||
| 99 | $validator->php(  | 
            ||
| 100 | [  | 
            ||
| 101 | 'required-text-field-3' => 'some text',  | 
            ||
| 102 | 'radio-option-2' => 'Y',  | 
            ||
| 103 | 'conditional-required-text-2' => '',  | 
            ||
| 104 | 'conditional-required-text-3' => ''  | 
            ||
| 105 | ]  | 
            ||
| 106 | ),  | 
            ||
| 107 | 'Fails when conditional required is displayed but not completed'  | 
            ||
| 108 | );  | 
            ||
| 109 | |||
| 110 | $this->assertTrue(  | 
            ||
| 111 | $validator->php(  | 
            ||
| 112 | [  | 
            ||
| 113 | 'required-text-field-3' => 'some text',  | 
            ||
| 114 | 'radio-option-3' => 'Y',  | 
            ||
| 115 | 'conditional-required-text-2' => 'this text',  | 
            ||
| 116 | 'conditional-required-text-3' => ''  | 
            ||
| 117 | ]  | 
            ||
| 118 | ),  | 
            ||
| 119 | 'Passes when non-conditional required field has a value'  | 
            ||
| 120 | );  | 
            ||
| 121 | |||
| 122 | $this->assertFalse(  | 
            ||
| 123 | $validator->php(  | 
            ||
| 124 | [  | 
            ||
| 125 | 'required-text-field-3' => 'some text',  | 
            ||
| 126 | 'radio-option-3' => 'Y',  | 
            ||
| 127 | 'conditional-required-text-2' => 'Show more',  | 
            ||
| 128 | 'conditional-required-text-3' => ''  | 
            ||
| 129 | ]  | 
            ||
| 130 | ),  | 
            ||
| 131 | 'Fails when nested conditional required is displayed but not completed'  | 
            ||
| 132 | );  | 
            ||
| 133 | |||
| 134 | $this->assertTrue(  | 
            ||
| 135 | $validator->php(  | 
            ||
| 136 | [  | 
            ||
| 137 | 'required-text-field-3' => 'some text',  | 
            ||
| 138 | 'radio-option-3' => 'Y',  | 
            ||
| 139 | 'conditional-required-text-2' => 'Show more',  | 
            ||
| 140 | 'conditional-required-text-3' => 'more text'  | 
            ||
| 141 | ]  | 
            ||
| 142 | ),  | 
            ||
| 143 | 'Passes when nested conditional required field has a value'  | 
            ||
| 144 | );  | 
            ||
| 147 |