/** * @Given there is a topic labeled :topicLabel having :attendeeCount votes */ public function thereIsATopicLabeledHavingVotes($topicLabel, $attendeeCount) { $topic = new Topic(); $topic->setIssue($topicLabel); $topic->setPid(1); for ($i = 0; $i < $attendeeCount; $i++) { $attendee = new Attendee(); $attendee->setName('Example Name ' . ($i + 1)); $attendee->setEmail('example' . ($i + 1) . '@domain.com'); $attendee->setPid(1); $topic->addAttendee($attendee); } // add topic $this->topicRepository->add($topic); // persist topic $this->typo3PersistenceManager->persistAll(); }
/** * @test */ public function removeAttendeeFromObjectStorageHoldingAttendees() { $attendee = new Attendee(); $attendees = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage', array('detach'), array(), '', false); $attendees->expects($this->once())->method('detach')->with($this->equalTo($attendee)); $this->inject($this->subject, 'attendees', $attendees); $this->subject->removeAttendee($attendee); }