change test

This commit is contained in:
m 2018-04-08 11:29:03 +02:00
parent 179235eaf9
commit 46df3b6fce

View File

@ -112,7 +112,7 @@ class PollService {
* @return \stdClass * @return \stdClass
*/ */
function addVote($poll_id, $name, $choices, $slots_hash) { function addVote($poll_id, $name, $choices, $slots_hash) {
$this->checkVoteConstraints($choices, $poll_id, $slots_hash, $name, NULL); $this->checkVoteConstraints($choices, $poll_id, $slots_hash, $name);
// Insert new vote // Insert new vote
$choices = implode($choices); $choices = implode($choices);
@ -298,14 +298,14 @@ class PollService {
* @param $poll_id * @param $poll_id
* @param $slots_hash * @param $slots_hash
* @param $name * @param $name
* @param string|NULL $vote_id * @param string $vote_id
* @throws AlreadyExistsException * @throws AlreadyExistsException
* @throws ConcurrentVoteException * @throws ConcurrentVoteException
* @throws ConcurrentEditionException * @throws ConcurrentEditionException
*/ */
private function checkVoteConstraints($choices, $poll_id, $slots_hash, $name, $vote_id) { private function checkVoteConstraints($choices, $poll_id, $slots_hash, $name, $vote_id = FALSE) {
// Check if vote already exists with the same name // Check if vote already exists with the same name
if (!isset($vote_id)) { if (FALSE === $vote_id) {
$exists = $this->voteRepository->existsByPollIdAndName($poll_id, $name); $exists = $this->voteRepository->existsByPollIdAndName($poll_id, $name);
} else { } else {
$exists = $this->voteRepository->existsByPollIdAndNameAndVoteId($poll_id, $name, $vote_id); $exists = $this->voteRepository->existsByPollIdAndNameAndVoteId($poll_id, $name, $vote_id);