ModuleHealthLoaderTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 7 1
A testModuleNamesAreInTheRequestUrl() 0 9 1
1
<?php
2
3
use BringYourOwnIdeas\Maintenance\Util\ModuleHealthLoader;
4
use SilverStripe\Dev\SapphireTest;
5
6
class ModuleHealthLoaderTest extends SapphireTest
7
{
8
    /**
9
     * @var ModuleHealthLoader
10
     */
11
    protected $loader;
12
13
    protected function setUp(): void
14
    {
15
        parent::setUp();
16
17
        $this->loader = $this->getMockBuilder(ModuleHealthLoader::class)
18
            ->setMethods(['doRequest'])
19
            ->getMock();
20
    }
21
22
    public function testModuleNamesAreInTheRequestUrl()
23
    {
24
        $this->loader->setModuleNames(['foo/bar', 'bar/baz']);
25
26
        $this->loader->expects($this->once())
0 ignored issues
show
Bug introduced by
The method expects() does not exist on BringYourOwnIdeas\Mainte...Util\ModuleHealthLoader. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

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

26
        $this->loader->/** @scrutinizer ignore-call */ 
27
                       expects($this->once())
Loading history...
27
            ->method('doRequest')
28
            ->with('addons.silverstripe.org/api/ratings?addons=foo/bar,bar/baz');
29
30
        $this->loader->getModuleHealthInfo();
31
    }
32
}
33