AbstractRuleTest::testIsSatisfiedBy()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %
Metric Value
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 3
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