コード例 #1
0
 /**
  * @param boolean $return
  * @dataProvider configResultProvider
  */
 public function testIsAttachmentAssociationEnabled($return)
 {
     $entity = $this->getMock('\\stdClass');
     $this->attachmentConfig->expects($this->once())->method('isAttachmentAssociationEnabled')->with($entity)->willReturn($return);
     $actual = $this->filter->isAttachmentAssociationEnabled($entity);
     $this->assertEquals($return, $actual);
 }
コード例 #2
0
 /**
  * @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);
 }
コード例 #3
0
 public function testIsAttachmentAssociationEnabled()
 {
     $config = new Config(new EntityConfigId('attachment', 'stdClass'));
     $config->set('enabled', true);
     $this->attachmentConfigProvider->expects($this->once())->method('hasConfig')->with('stdClass')->will($this->returnValue(true));
     $this->attachmentConfigProvider->expects($this->once())->method('getConfig')->with('stdClass')->will($this->returnValue($config));
     $this->entityConfigProvider->expects($this->once())->method('hasConfig')->with(AttachmentScope::ATTACHMENT, ExtendHelper::buildAssociationName('stdClass'))->will($this->returnValue(true));
     $this->assertTrue($this->filter->isAttachmentAssociationEnabled(new \stdClass()));
 }