public function testLinkEmailAttachmentToTargetEntity() { $emailAttachment = $this->getEmailAttachment(); $this->emailAttachmentManager->method('buildAttachmentInstance')->withAnyParameters()->will($this->returnValue($this->attachment)); $emailAttachment->expects($this->once())->method('setFile')->withAnyParameters(); $this->attachment->expects($this->never())->method('setFile')->withAnyParameters(); $this->configFileValidator->expects($this->any())->method('validate')->willReturn($this->getMock('Countable')); $this->emailAttachmentManager->linkEmailAttachmentToTargetEntity($emailAttachment, new SomeEntity()); }