/** * @test * @dataProvider fieldValuesInTypoScriptDataProvider */ public function exportServiceWorksWithDifferentFormattedTypoScriptValues($uid, $fields, $expected) { $mockRegistration = $this->getMock('DERHANSEN\\SfEventMgt\\Domain\\Model\\Registration', ['_hasProperty', '_getCleanProperty'], [], '', false); $mockRegistration->expects($this->at(0))->method('_hasProperty')->with($this->equalTo('uid'))->will($this->returnValue(true)); $mockRegistration->expects($this->at(2))->method('_hasProperty')->with($this->equalTo('firstname'))->will($this->returnValue(true)); $mockRegistration->expects($this->at(4))->method('_hasProperty')->with($this->equalTo('lastname'))->will($this->returnValue(true)); $mockRegistration->expects($this->at(1))->method('_getCleanProperty')->with($this->equalTo('uid'))->will($this->returnValue(1)); $mockRegistration->expects($this->at(3))->method('_getCleanProperty')->with($this->equalTo('firstname'))->will($this->returnValue('Max')); $mockRegistration->expects($this->at(5))->method('_getCleanProperty')->with($this->equalTo('lastname'))->will($this->returnValue('Mustermann')); $allRegistrations = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $allRegistrations->attach($mockRegistration); $registrationRepository = $this->getMock('DERHANSEN\\SfEventMgt\\Domain\\Repository\\Registration', ['findByEvent'], [], '', false); $registrationRepository->expects($this->once())->method('findByEvent')->will($this->returnValue($allRegistrations)); $this->inject($this->subject, 'registrationRepository', $registrationRepository); $returnValue = $this->subject->exportRegistrationsCsv($uid, $fields); $this->assertSame($expected, $returnValue); }