/** * Tests if fromEventProperty returns expected attachments for objectStorage property * @test */ public function getAttachmentsReturnsAttachmentsFromEventPropertyWithObjectStorage() { $registration = new \DERHANSEN\SfEventMgt\Domain\Model\Registration(); $event = new \DERHANSEN\SfEventMgt\Domain\Model\Event(); $mockFile1 = $this->getMock('TYPO3\\CMS\\Core\\Resource\\File', ['getForLocalProcessing'], [], '', false); $mockFile1->expects($this->any())->method('getForLocalProcessing')->will($this->returnValue('/path/to/somefile.pdf')); $mockFileRef1 = $this->getMock('TYPO3\\CMS\\Extbase\\Domain\\Model\\FileReference', ['getOriginalResource'], [], '', false); $mockFileRef1->expects($this->any())->method('getOriginalResource')->will($this->returnValue($mockFile1)); $mockFile2 = $this->getMock('TYPO3\\CMS\\Core\\Resource\\File', ['getForLocalProcessing'], [], '', false); $mockFile2->expects($this->any())->method('getForLocalProcessing')->will($this->returnValue('/path/to/anotherfile.pdf')); $mockFileRef2 = $this->getMock('TYPO3\\CMS\\Extbase\\Domain\\Model\\FileReference', ['getOriginalResource'], [], '', false); $mockFileRef2->expects($this->any())->method('getOriginalResource')->will($this->returnValue($mockFile2)); $event->addFiles($mockFileRef1); $event->addFiles($mockFileRef2); $registration->setEvent($event); $settings = ['notification' => ['registrationNew' => ['attachments' => ['user' => ['fromEventProperty' => ['files']]]]]]; $expected = ['/path/to/somefile.pdf', '/path/to/anotherfile.pdf']; $attachments = $this->subject->getAttachments($settings, $registration, MessageType::REGISTRATION_NEW, MessageRecipient::USER); $this->assertEquals($expected, $attachments); }