public function testSetVotesAndGetVotes() { $this->assertSame([], $this->rfc->getVotes()); $votes = ['Introduce the in operator?' => ['headers' => ['Real name', 'Yes', 'No'], 'votes' => ['aharvey (aharvey)' => ['Yes' => false, 'No' => true], 'ajf (ajf)' => ['Yes' => false, 'No' => true]], 'counts' => ['Real name' => 'Count:', 'Yes' => 0, 'No' => 2], 'closed' => false]]; $this->rfc->setVotes($votes); $this->assertSame($votes, $this->rfc->getVotes()); }
/** * @dataProvider rfcDiffDataProvider */ public function testRfcDiffReturnsCorrectDiff($details, $changeLogs, $votes, $expectedDiff) { $rfc1 = new Rfc(); $rfc2 = new Rfc(); $rfc1->setDetails($details[0]); $rfc1->setChangeLog($changeLogs[0]); $rfc1->setVotes($votes[0]); $rfc2->setDetails($details[1]); $rfc2->setChangeLog($changeLogs[1]); $rfc2->setVotes($votes[1]); $this->assertSame($expectedDiff, $this->diffService->rfcDiff($rfc1, $rfc2)); }
public function testGetVotesAsTableRows() { $rfc = new Rfc(); $rfc->setVotes(['Introduce the in operator?' => ['headers' => ['Real name', 'Yes', 'No'], 'votes' => ['aharvey (aharvey)' => ['Yes' => false, 'No' => true], 'ajf (ajf)' => ['Yes' => false, 'No' => true], 'ben (ben)' => ['Yes' => true, 'No' => false]], 'counts' => ['Real name' => 'Count:', 'Yes' => 0, 'No' => 2], 'closed' => false]]); $result = $this->rfcService->getVotesAsTableRows($rfc, 'Introduce the in operator?'); $expected = [['aharvey (aharvey)', false, true], ['ajf (ajf)', false, true], ['ben (ben)', true, false]]; $this->assertSame($expected, $result); }
/** * Add votes and vote description to RFC * * @return self */ public function loadVotes() { $this->rfc->setVoteDescription($this->parseVoteDescription()); $this->rfc->setVotes($this->parseVotes()); return $this; }