Participants collection - disable method has(), because hasParticipantsOfSurvey() should be used to verify if there are participants of given survey

This commit is contained in:
Meritoo
2017-09-29 15:07:26 +02:00
parent cacb2b3b92
commit beaf61d2ea
2 changed files with 14 additions and 0 deletions

View File

@@ -40,6 +40,14 @@ class Participants extends Collection
throw new DisabledMethodException(__METHOD__, 'addParticipants'); throw new DisabledMethodException(__METHOD__, 'addParticipants');
} }
/**
* {@inheritdoc}
*/
public function has($element)
{
throw new DisabledMethodException(__METHOD__, 'hasParticipantsOfSurvey');
}
/** /**
* Adds participants of given survey * Adds participants of given survey
* *

View File

@@ -61,6 +61,12 @@ class ParticipantsTest extends BaseTestCase
(new Participants())->addMultiple([]); (new Participants())->addMultiple([]);
} }
public function testHas()
{
$this->expectException(DisabledMethodException::class);
(new Participants())->has(new Participant());
}
public function testAddParticipantsWithoutParticipants() public function testAddParticipantsWithoutParticipants()
{ {
$surveyId = 1; $surveyId = 1;