AbstractRulesSetTest::setUp()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 14
Code Lines 10

Duplication

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