public function testUnsupportedAttachments() { $entity = new TestClass(); $this->attachmentConfig->expects($this->once())->method('isAttachmentAssociationEnabled')->with($entity)->willReturn(false); $result = $this->attachmentProvider->getEntityAttachments($entity); $this->assertEquals([], $result); }
/** * @param null|object $entity * @param bool $attachmentConfigReturn * @param bool $isNewRecord * @param bool $isManaged * @param bool $expected * @dataProvider configResultProvider */ public function testIsAttachmentAssociationEnabled($entity, $attachmentConfigReturn, $isNewRecord, $isManaged, $expected) { $this->attachmentConfig->expects(is_object($entity) && !$isNewRecord ? $this->once() : $this->never())->method('isAttachmentAssociationEnabled')->with($entity)->willReturn($attachmentConfigReturn); $this->doctrineHelper->expects(is_object($entity) && $isManaged ? $this->once() : $this->never())->method('isNewEntity')->willReturn($isNewRecord); $this->doctrineHelper->expects(is_object($entity) ? $this->once() : $this->never())->method('isManageableEntity')->willReturn($isManaged); $actual = $this->filter->isAttachmentAssociationEnabled($entity); $this->assertEquals($expected, $actual); }