AbstractRulesSetTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Dependencies 4
Metric Value
wmc 2
cbo 4
dl 0
loc 36
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 14 1
A testDomainExceptionIsThrownOnEmptyGameRules() 0 8 1
1
<?php
2
3
namespace Tests\Unit\GameDomain\Rule;
4
5
use Doctrine\Common\Collections\ArrayCollection;
6
7
/**
8
 * AbstractRulesSet Tests
9
 */
10
class AbstractRulesSetTest extends \PHPUnit_Framework_TestCase
11
{
12
    /** @var \GameDomain\Rule\AbstractRulesSet|\PHPUnit_Framework_MockObject_MockObject */
13
    protected $sut;
14
15
    /**
16
     * {@inheritDoc}
17
     */
18
    public function setUp()
19
    {
20
        $this->sut = $this->getMockForAbstractClass(
21
            '\GameDomain\Rule\AbstractRulesSet',
22
            array(),
23
            '',
24
            false,
25
            false,
26
            true,
27
            array(
28
                'toArray'
29
            )
30
        );
31
    }
32
33
    /**
34
     * @expectedException \DomainException
35
     * @expectedExceptionMessage No valid answer can be generated from the current rules set.
36
     */
37
    public function testDomainExceptionIsThrownOnEmptyGameRules()
38
    {
39
        $this->sut->expects($this->once())
40
            ->method('toArray')
41
            ->will($this->returnValue(new ArrayCollection()));
42
43
        $this->sut->generateValidAnswer(1);
44
    }
45
}
46