public function testGetOwnerType() { $entity = new BusinessUnit(); $className = 'Oro\\Bundle\\OrganizationBundle\\Entity\\BusinessUnit'; $config = $this->getMockBuilder('Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigInterface')->disableOriginalConstructor()->getMock(); $config->expects($this->once())->method('all')->will($this->returnValue(array('owner_type' => 'test_type'))); $this->configProvider->expects($this->once())->method('hasConfig')->with($this->equalTo($className))->will($this->returnValue(true)); $this->configProvider->expects($this->once())->method('getConfig')->with($this->equalTo($className))->will($this->returnValue($config)); $this->assertEquals('test_type', $this->extension->getOwnerType($entity)); }
public function testWithoutOwnerType() { $entity = new BusinessUnit(); $className = 'Oro\\Bundle\\OrganizationBundle\\Entity\\BusinessUnit'; /** @var \PHPUnit_Framework_MockObject_MockObject|ConfigIdInterface $configId */ $configId = $this->getMock('Oro\\Bundle\\EntityConfigBundle\\Config\\Id\\ConfigIdInterface'); $config = new Config($configId); $config->setValues(['another_owner_type' => 'test_type']); $this->configProvider->expects($this->once())->method('hasConfig')->with($this->equalTo($className))->will($this->returnValue(true)); $this->configProvider->expects($this->once())->method('getConfig')->with($this->equalTo($className))->will($this->returnValue($config)); $this->assertNull($this->extension->getOwnerType($entity)); }
public function testWithoutOwnerType() { $entity = new BusinessUnit(); $this->prepareConfigProvider(['another_owner_type' => 'test_type'], 'Oro\\Bundle\\OrganizationBundle\\Entity\\BusinessUnit'); $this->assertNull($this->extension->getOwnerType($entity)); }