AbstractRuleTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 3
Metric Value
wmc 3
cbo 3
dl 0
loc 38
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testIsSatisfiedBy() 0 4 1
A getSatisfiedByData() 0 9 1
1
<?php
2
3
namespace Tests\Unit\GameDomain\Rule;
4
5
use GameDomain\Round\Step\Answer;
6
use Tests\Unit\GameDomain\Rule\Mocks\TestRule;
7
8
/**
9
 * AbstractRule Test
10
 */
11
class AbstractRuleTest extends \PHPUnit_Framework_TestCase
12
{
13
    /** @var \Tests\Unit\GameDomain\Rule\Mocks\TestRule */
14
    protected $sut;
15
16
    /**
17
     * {@inheritDoc}
18
     */
19
    public function setUp()
20
    {
21
        $this->sut = new TestRule();
22
    }
23
24
    /**
25
     * @dataProvider getSatisfiedByData
26
     *
27
     * @param \GameDomain\Round\Step\Answer $answer
28
     * @param int                           $number
29
     * @param bool                          $expectedResult
30
     */
31
    public function testIsSatisfiedBy(Answer $answer, $number, $expectedResult)
32
    {
33
        $this->assertEquals($expectedResult, $this->sut->isSatisfiedBy($answer, $number));
34
    }
35
36
    /**
37
     * @return array
38
     */
39
    public function getSatisfiedByData()
40
    {
41
        return array(
42
            array(new Answer(-1), -1, false),
43
            array(new Answer(0), 0, false),
44
            array(new Answer(1), 1, true),
45
            array(new Answer(PHP_INT_MAX), PHP_INT_MAX, true),
46
        );
47
    }
48
}
49