Passed
Push — master ( fcb909...cb681d )
by Robbie
02:26
created

ModuleHealthLoaderTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 7
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
use BringYourOwnIdeas\Maintenance\Util\ModuleHealthLoader;
4
use SilverStripe\Dev\SapphireTest;
5
6
class ModuleHealthLoaderTest extends SapphireTest
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
7
{
8
    /**
9
     * @var ModuleHealthLoader
10
     */
11
    protected $loader;
12
13
    protected function setUp()
14
    {
15
        parent::setUp();
16
17
        $this->loader = $this->getMockBuilder(ModuleHealthLoader::class)
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->getMockBuilder(Br...doRequest'))->getMock() of type PHPUnit_Framework_MockObject_MockObject is incompatible with the declared type BringYourOwnIdeas\Mainte...Util\ModuleHealthLoader of property $loader.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
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