Passed
Pull Request — master (#1312)
by Michael
05:26
created

MockStopWords   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 5
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Xmf\Test;
6
7
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...
8
9
10
use Xmf\StopWords;
11
12
/**
13
 * Mock StopWords
14
 */
15
class MockStopWords extends \Xmf\StopWords
16
{
17
    public function __construct()
18
    {
19
        $this->stopwordList = array_fill_keys(['it', 'is', 'our', 'mock'], true);
20
    }
21
}
22
23
class StopWordsTest extends TestCase
24
{
25
    /**
26
     * @var StopWords
27
     */
28
    protected $object;
29
30
    /**
31
     * Sets up the fixture, for example, opens a network connection.
32
     * This method is called before a test is executed.
33
     */
34
    protected function setUp(): void
35
    {
36
        $this->object = new MockStopWords();
37
    }
38
39
    /**
40
     * Tears down the fixture, for example, closes a network connection.
41
     * This method is called after a test is executed.
42
     */
43
    protected function tearDown(): void
44
    {
45
    }
46
47
    public function testCheck()
48
    {
49
        $this->assertTrue($this->object->check('XOOPS'));
50
        $this->assertFalse($this->object->check('is'));
51
        $this->assertFalse($this->object->check('IS'));
52
    }
53
}
54