public function testIsEntityAuditable() { $config = new Config(new EntityConfigId('dataaudit', self::TEST_ENTITY_REFERENCE)); $config->set('auditable', true); $this->configProvider->expects($this->once())->method('hasConfig')->with(self::TEST_ENTITY_REFERENCE)->will($this->returnValue(true)); $this->configProvider->expects($this->once())->method('getConfig')->with(self::TEST_ENTITY_REFERENCE)->will($this->returnValue($config)); $this->assertTrue($this->filter->isEntityAuditable(new LoggableClass(), false)); }
/** * @dataProvider isAuditableDataProvider */ public function testIsEntityAuditable($data, $expected) { if (isset($expected['class'])) { $this->configProvider->expects($this->once())->method('hasConfig')->with($expected['class'])->will($this->returnValue($expected['has_config_result'])); $auditable = $this->getMock('\\Oro\\Bundle\\EntityConfigBundle\\Config\\ConfigInterface'); $auditable->expects($this->once())->method('is')->with('auditable')->will($this->returnValue($expected['is_auditable_result'])); $this->configProvider->expects($this->once())->method('getConfig')->with($expected['class'])->will($this->returnValue($auditable)); } $result = $this->filter->isEntityAuditable($data['entity'], $data['entity_class'], $data['show']); $this->assertEquals($expected['result'], $result); }