Passed
Push — master ( 8cb109...9d7e65 )
by Lucien
01:36
created

PluginToolsTest::testGetPluginByTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
3
use PHPUnit\Framework\TestCase;
0 ignored issues
show
Bug introduced by
The type PHPUnit\Framework\TestCase was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
4
use TwinDigital\WPTools\PluginTools;
5
6
class PluginToolsTest extends TestCase {
7
8
  /**
9
   * Tests if the plugin_list is loaded.
10
   *
11
   * @covers \TwinDigital\WPTools\PluginTools::loadPluginList()
12
   * @return void
13
   */
14
  public function testLoadPluginList() {
15
    $this->assertNotCount(0, PluginTools::$loadedPlugins, 'Pluginlist is empty, probably failed loading the list of plugins.');
16
  }
17
18
  /**
19
   * Tests if the plugin_list is loaded.
20
   *
21
   * @covers \TwinDigital\WPTools\PluginTools::loadPluginList()
22
   * @return void
23
   */
24
  public function testLoadPluginListForced() {
25
    PluginTools::loadPluginList(true);
26
    $this->assertNotCount(0, PluginTools::$loadedPlugins, 'Pluginlist is empty, probably failed loading the list of plugins.');
27
  }
28
29
  /**
30
   * Tests if the plugin_list is loaded.
31
   *
32
   * @covers \TwinDigital\WPTools\PluginTools::refreshLoadedPlugins()
33
   * @return void
34
   */
35
  public function testRefreshLoadedPlugins() {
36
    PluginTools::$loadedPlugins = null;
37
    PluginTools::refreshLoadedPlugins();
38
    $this->assertNotCount(0, PluginTools::$loadedPlugins, 'Pluginlist is empty, probably failed loading the list of plugins.');
39
  }
40
41
  /**
42
   * Tests if the plugin_list is loaded.
43
   *
44
   * @covers \TwinDigital\WPTools\PluginTools::getPluginByTitle()
45
   * @return void
46
   */
47
  public function testGetPluginByTitle() {
48
    PluginTools::refreshLoadedPlugins();
49
    $this->assertEmpty(PluginTools::getPluginByTitle('Non-existing-plugin', 'Found a plugin that is non-existing? Oops'));
0 ignored issues
show
Bug introduced by
'Found a plugin that is non-existing? Oops' of type string is incompatible with the type boolean expected by parameter $case_sensitive of TwinDigital\WPTools\Plug...ols::getPluginByTitle(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

49
    $this->assertEmpty(PluginTools::getPluginByTitle('Non-existing-plugin', /** @scrutinizer ignore-type */ 'Found a plugin that is non-existing? Oops'));
Loading history...
50
    $this->assertNotEmpty(PluginTools::getPluginByTitle('WPTools', 'Current plugin is not active?'));
51
  }
52
}
53