Completed
Push — master ( 3a37c9...90ceec )
by Michael
04:14
created

StvElectionTest::testNewElection()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 25
Code Lines 19

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 25
rs 8.8571
cc 1
eloc 19
nc 1
nop 0
1
<?php
2
3
namespace Tests\Michaelc\Voting;
4
5
use Michaelc\Voting\STV\{Election, Candidate, Ballot};
6
7
class StvElectionTest extends \PHPUnit_Framework_TestCase
8
{
9
	public function testNewElection()
10
	{
11
		$winners = 2;
12
		$candidateCount = 6;
13
14
		$candidates = $ballots = [];
15
		$candidates[1] = new Candidate(1);
16
		$candidates[2] = new Candidate(2);
17
		$candidates[3] = new Candidate(3);
18
		$candidates[4] = new Candidate(4);
19
		$candidates[5] = new Candidate(5);
20
		$candidates[6] = new Candidate(6);
21
22
		$ballots[] = new Ballot([4, 5, 6]);
23
		$ballots[] = new Ballot([1, 2, 3]);
24
		$ballots[] = new Ballot([4, 5, 6]);
25
		$ballots[] = new Ballot([1, 4, 2]);
26
27
		$election = new Election($winners, $candidates, $ballots);
28
29
		$this->assertEquals($candidates[3], $election->getCandidate(3));
30
		$this->assertEquals($candidateCount, $election->getCandidateCount());
31
		$this->assertEquals($candidateCount, $election->getActiveCandidateCount());
32
		$this->assertEquals($winners, $election->getWinnersCount());
33
	}
34
}
35