| Conditions | 1 |
| Paths | 1 |
| Total Lines | 61 |
| Code Lines | 46 |
| 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 |
||
| 29 | public function testPluginRequirements() { |
||
| 30 | PluginTools::refreshLoadedPlugins(); |
||
| 31 | // Add plugin to requirements-list, first time should be true, second time false because requirement already in list. |
||
| 32 | $this->assertTrue( |
||
| 33 | PluginRequirements::addPluginRequirement( |
||
| 34 | 'Hello Dolly', |
||
| 35 | '0.0.0', |
||
| 36 | '0.0.0', |
||
| 37 | true |
||
| 38 | ), |
||
| 39 | 'Could not add fake requirements' |
||
| 40 | ); |
||
| 41 | $this->assertFalse( |
||
| 42 | PluginRequirements::addPluginRequirement( |
||
| 43 | 'Hello Dolly', |
||
| 44 | '0.0.0', |
||
| 45 | '0.0.0', |
||
| 46 | true |
||
| 47 | ), |
||
| 48 | 'Check for existing requirement failed' |
||
| 49 | ); |
||
| 50 | $this->assertTrue( |
||
| 51 | PluginRequirements::addPluginRequirement( |
||
| 52 | 'WPTools', |
||
| 53 | '0.0.0', |
||
| 54 | '0.0.0', |
||
| 55 | true |
||
| 56 | ), |
||
| 57 | 'Could not add fake requirements' |
||
| 58 | ); |
||
| 59 | // Testing requiredPlugins should be false, since we set fake version-numbers. |
||
| 60 | $this->assertFalse( |
||
| 61 | PluginRequirements::checkRequiredPlugins(), |
||
| 62 | 'Requirement should not be met unless version number of Hello Dolly is 0.0.0' |
||
| 63 | ); |
||
| 64 | $this->assertTrue(PluginRequirements::removePluginRequirement('WPTools')); |
||
| 65 | |||
| 66 | $this->assertTrue(PluginRequirements::removePluginRequirement('Hello Dolly')); |
||
| 67 | $this->assertFalse(PluginRequirements::removePluginRequirement('Hello Dolly')); |
||
| 68 | $this->assertTrue(PluginRequirements::checkRequiredPlugins()); |
||
| 69 | activate_plugin('hello-dolly/hello.php'); |
||
| 70 | PluginTools::refreshLoadedPlugins(); |
||
| 71 | $this->assertTrue( |
||
| 72 | PluginRequirements::addPluginRequirement( |
||
| 73 | 'Hello Dolly', |
||
| 74 | '0.0.0', |
||
| 75 | '999.999.999', |
||
| 76 | false |
||
| 77 | ) |
||
| 78 | ); |
||
| 79 | $this->assertTrue(PluginRequirements::checkRequiredPlugins(), 'Hello Dolly should not be active yet.'); |
||
| 80 | $this->assertTrue(PluginRequirements::removePluginRequirement('Hello Dolly')); |
||
| 81 | $this->assertTrue( |
||
| 82 | PluginRequirements::addPluginRequirement( |
||
| 83 | 'Hello Dolly', |
||
| 84 | '0.0.0', |
||
| 85 | '999.999.999', |
||
| 86 | true |
||
| 87 | ) |
||
| 88 | ); |
||
| 89 | $this->assertFalse(PluginRequirements::checkRequiredPlugins(), 'Hello Dolly should not be active yet.'); |
||
| 90 | } |
||
| 92 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths