commit
71efe2109a
@ -163,6 +163,18 @@ class FilterCollection
|
||||
return $this->enabledFilters[$name];
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a filter is enabled.
|
||||
*
|
||||
* @param string $name Name of the filter.
|
||||
*
|
||||
* @return boolean True if the filter is enabled, false otherwise.
|
||||
*/
|
||||
public function isEnabled($name)
|
||||
{
|
||||
return isset($this->enabledFilters[$name]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean True, if the filter collection is clean.
|
||||
*/
|
||||
|
@ -172,6 +172,26 @@ class SQLFilterTest extends \Doctrine\Tests\OrmFunctionalTestCase
|
||||
$this->assertTrue($exceptionThrown);
|
||||
}
|
||||
|
||||
/**
|
||||
* @group DDC-2203
|
||||
*/
|
||||
public function testEntityManagerIsFilterEnabled()
|
||||
{
|
||||
$em = $this->_getEntityManager();
|
||||
$this->configureFilters($em);
|
||||
|
||||
// Check for an enabled filter
|
||||
$em->getFilters()->enable("locale");
|
||||
$this->assertTrue($em->getFilters()->isEnabled("locale"));
|
||||
|
||||
// Check for a disabled filter
|
||||
$em->getFilters()->disable("locale");
|
||||
$this->assertFalse($em->getFilters()->isEnabled("locale"));
|
||||
|
||||
// Check a non-existing filter
|
||||
$this->assertFalse($em->getFilters()->isEnabled("foo_filter"));
|
||||
}
|
||||
|
||||
protected function configureFilters($em)
|
||||
{
|
||||
// Add filters to the configuration of the EM
|
||||
|
Loading…
x
Reference in New Issue
Block a user