CheckTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testGetResult() 0 10 1
A resultProvider() 0 5 1
1
<?php
2
3
namespace SilverStripe\ModuleRatings\Tests;
4
5
use PHPUnit\Framework\TestCase;
6
use SilverStripe\ModuleRatings\Check;
7
8
class CheckTest extends TestCase
9
{
10
    /**
11
     * @param bool $isSuccessful
12
     * @param int $expected
13
     * @dataProvider resultProvider
14
     */
15
    public function testGetResult($isSuccessful, $expected)
16
    {
17
        $check = $this->getMockBuilder(Check::class)
18
            ->getMockForAbstractClass();
19
20
        $check
21
            ->setPoints(10)
22
            ->setSuccessful($isSuccessful);
23
24
        $this->assertSame($expected, $check->getResult());
25
    }
26
27
    /**
28
     * @return array[]
29
     */
30
    public function resultProvider()
31
    {
32
        return [
33
            'succeeded' => [true, 10],
34
            'failed' => [false, 0],
35
        ];
36
    }
37
}
38