Passed
Push — master ( 4315fd...33ec80 )
by Lucien
02:37
created

FilterTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 2
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 2
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
namespace TwinDigital\WPTools;
4
5
use WP_UnitTestCase;
0 ignored issues
show
Bug introduced by
The type WP_UnitTestCase 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...
6
7
/**
8
 * Class FilterTest
9
 */
10
class FilterTest extends WP_UnitTestCase {
11
12
  /**
13
   * Setup
14
   * @return void
15
   */
16
  public function setUp() {
17
    parent::setUp();
18
  }
19
20
  /**
21
   * Test filter removal from classes.
22
   *
23
   * @covers \TwinDigital\WPTools\Filter::remove()
24
   *
25
   * @return void
26
   */
27
  public function testRemove() {
28
    $filter   = 'testfilter';
29
    $class    = Filter::class;
30
    $function = 'nonExistentFunction';
31
    $priority = 10;
32
    $this->assertFalse(Filter::remove($filter, $class, $function), 'Should not be able te remove a filter that is not added');
33
    add_filter($filter, $function, $priority, 0);
34
    $this->assertTrue(Filter::remove($filter, $class, $function), 'Should be able te remove a filter that is added');
35
    $this->assertFalse(Filter::remove($filter, $class, $function), 'Should not be able te remove a filter that is not added');
36
  }
37
}
38