CheckSuiteIntegrationTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 6 1
A testRun() 0 10 1
1
<?php
2
3
namespace SilverStripe\ModuleRatings\Tests;
4
5
use PHPUnit\Framework\TestCase;
6
use SilverStripe\ModuleRatings\CheckSuite;
7
8
/**
9
 * @group integration
10
 */
11
class CheckSuiteIntegrationTest extends TestCase
12
{
13
    /**
14
     * @var CheckSuite
15
     */
16
    protected $checkSuite;
17
18
    protected function setUp(): void
19
    {
20
        parent::setUp();
21
22
        $this->checkSuite = new CheckSuite();
23
        $this->checkSuite->setModuleRoot(dirname(__FILE__) . '/TestModule');
24
    }
25
26
    /**
27
     * Runs a test check suite over the "TestModule" test module directory. Note that at this point this doesn't
28
     * stub the results from API based checks, but rather just ignores them because no repository slug is provided.
29
     */
30
    public function testRun()
31
    {
32
        $this->checkSuite->run();
33
34
        $this->assertEquals(
35
            58,
36
            $this->checkSuite->getScore(),
37
            'Checks failed. Details: ' . json_encode($this->checkSuite->getCheckDetails())
38
        );
39
        $this->assertEquals(0, $this->checkSuite->getCheckDetails()['ci_passing']['points']);
40
    }
41
}
42