1
0
mirror of synced 2025-01-18 06:21:40 +03:00

Merge pull request #548 from nemekzg/DDC-2203

Fix for DDC-2203
This commit is contained in:
Guilherme Blanco 2013-01-10 11:13:18 -08:00
commit 71efe2109a
2 changed files with 32 additions and 0 deletions

View File

@ -163,6 +163,18 @@ class FilterCollection
return $this->enabledFilters[$name]; 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. * @return boolean True, if the filter collection is clean.
*/ */

View File

@ -172,6 +172,26 @@ class SQLFilterTest extends \Doctrine\Tests\OrmFunctionalTestCase
$this->assertTrue($exceptionThrown); $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) protected function configureFilters($em)
{ {
// Add filters to the configuration of the EM // Add filters to the configuration of the EM