From beaf61d2ea7c72de10137b4395c0612ae9dd4b56 Mon Sep 17 00:00:00 2001 From: Meritoo Date: Fri, 29 Sep 2017 15:07:26 +0200 Subject: [PATCH] Participants collection - disable method has(), because hasParticipantsOfSurvey() should be used to verify if there are participants of given survey --- src/Result/Collection/Participants.php | 8 ++++++++ tests/Result/Collection/ParticipantsTest.php | 6 ++++++ 2 files changed, 14 insertions(+) diff --git a/src/Result/Collection/Participants.php b/src/Result/Collection/Participants.php index dfa65c9..f292dfa 100644 --- a/src/Result/Collection/Participants.php +++ b/src/Result/Collection/Participants.php @@ -40,6 +40,14 @@ class Participants extends Collection throw new DisabledMethodException(__METHOD__, 'addParticipants'); } + /** + * {@inheritdoc} + */ + public function has($element) + { + throw new DisabledMethodException(__METHOD__, 'hasParticipantsOfSurvey'); + } + /** * Adds participants of given survey * diff --git a/tests/Result/Collection/ParticipantsTest.php b/tests/Result/Collection/ParticipantsTest.php index d93e049..bfdb304 100644 --- a/tests/Result/Collection/ParticipantsTest.php +++ b/tests/Result/Collection/ParticipantsTest.php @@ -61,6 +61,12 @@ class ParticipantsTest extends BaseTestCase (new Participants())->addMultiple([]); } + public function testHas() + { + $this->expectException(DisabledMethodException::class); + (new Participants())->has(new Participant()); + } + public function testAddParticipantsWithoutParticipants() { $surveyId = 1;