1
0
Fork 0
mirror of synced 2025-04-01 20:36:14 +03:00

Fix for DDC-2203

This commit is contained in:
nemekzg 2013-01-10 16:52:19 +01:00
parent 9d0b254407
commit cfd1b07ffe
2 changed files with 32 additions and 0 deletions

View file

@ -160,6 +160,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.
*/

View file

@ -156,6 +156,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