| Conditions | 1 |
| Paths | 1 |
| Total Lines | 51 |
| 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 |
||
| 48 | public function testCheckLogical() |
||
| 49 | { |
||
| 50 | $wrapper = $this->prepareWrapper(FALSE); |
||
| 51 | $this->assertFalse(CheckHelper::check($wrapper, [ |
||
| 52 | 'NOT', |
||
| 53 | ['*=','field1', 'array.field1'] |
||
| 54 | ])); |
||
| 55 | $this->assertFalse(CheckHelper::check($wrapper, [ |
||
| 56 | 'AND', |
||
| 57 | ['*=','field1', 'array.field1'], |
||
| 58 | ['*>=','arrayObj.count()', 'arrayObj.count()'], |
||
| 59 | ['*=','field1', 'notExistField'] |
||
| 60 | ])); |
||
| 61 | $this->assertTrue(CheckHelper::check($wrapper, [ |
||
| 62 | 'OR', |
||
| 63 | ['*=','field1', 'array.field1'], |
||
| 64 | ['*>=','arrayObj.count()', 'arrayObj.count()'], |
||
| 65 | ['*=','field1', 'notExistField'] |
||
| 66 | ])); |
||
| 67 | $this->assertFalse(CheckHelper::check($wrapper, [ |
||
| 68 | 'OR', |
||
| 69 | ['*!=','field1', 'array.field1'], |
||
| 70 | ['*>','arrayObj.count()', 'arrayObj.count()'], |
||
| 71 | ['*=','field1', 'notExistField'] |
||
| 72 | ])); |
||
| 73 | $this->assertTrue(CheckHelper::check($wrapper, [ |
||
| 74 | 'and', |
||
| 75 | ['*=','field1', 'array.field1'], |
||
| 76 | ['*>=','arrayObj.count()', 'arrayObj.count()'], |
||
| 77 | [ |
||
| 78 | 'not', |
||
| 79 | ['*=','field1', 'notExistField'] |
||
| 80 | ], |
||
| 81 | [ |
||
| 82 | 'or', |
||
| 83 | ['*=','field1', 'array.field1'], |
||
| 84 | ['*>=','arrayObj.count()', 'arrayObj.count()'], |
||
| 85 | ['*=','field1', 'notExistField'] |
||
| 86 | ] |
||
| 87 | ])); |
||
| 88 | $this->assertTrue(CheckHelper::check($wrapper, [ |
||
| 89 | '*=field1' => 'array.field1', |
||
| 90 | '*>=arrayObj.count()' => 'arrayObj.count()', |
||
| 91 | '*<>field1' => 'notExistField' |
||
| 92 | ])); |
||
| 93 | $this->assertTrue(CheckHelper::check($wrapper, [ |
||
| 94 | 'field1' => 'value1', |
||
| 95 | '>=arrayObj.count()' => 1, |
||
| 96 | '<>field1' => 'notExist' |
||
| 97 | ])); |
||
| 98 | } |
||
| 99 | } |
||
| 100 |