/** * @test */ public function getFreePlacesWithRegistrationsTest() { $this->subject->setMaxParticipants(10); $registrationObjectStorageMock = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage', array('count'), array(), '', FALSE); $registrationObjectStorageMock->expects($this->once())->method('count')->will($this->returnValue(5)); $this->inject($this->subject, 'registration', $registrationObjectStorageMock); $this->assertEquals(5, $this->subject->getFreePlaces()); }
/** * @test * @return void */ public function isWaitlistRegistrationReturnsTrueIfEventFullyBookedAndNotEnoughFreePlaces() { $registrations = $this->getMock('TYPO3\\CMS\\Extbase\\Persistence\\ObjectStorage', [], [], '', false); $registrations->expects($this->any())->method('count')->will($this->returnValue(11)); $event = new Event(); $event->setEnableWaitlist(true); $event->setMaxParticipants(10); $event->setRegistration($registrations); $this->assertTrue($this->subject->isWaitlistRegistration($event, 1)); }