diff --git a/Test/Case/Controller/Component/FilterComponentTest.php b/Test/Case/Controller/Component/FilterComponentTest.php index 510c79a..8b9f2b3 100644 --- a/Test/Case/Controller/Component/FilterComponentTest.php +++ b/Test/Case/Controller/Component/FilterComponentTest.php @@ -49,17 +49,10 @@ public function setUp(): void $this->Controller = new DocumentTestsController($request); $this->Controller->uses = array('Document'); - if (array_search($method, array('testPersistence')) !== false) { - $this->Controller->components = array( - 'Session', - 'Filter.Filter' => array('nopersist' => true) - ); - } else { - $this->Controller->components = array( - 'Session', - 'Filter.Filter' - ); - } + $this->Controller->components = array( + 'Session', + 'Filter.Filter' + ); $this->Controller->constructClasses(); $this->Controller->Session->destroy(); @@ -440,6 +433,16 @@ public function testCustomSelector(): void ) ) ); + + /** + * For some reason the mock object DocumentCategory is not found by + * ClassRegistry::init('DocumentCategory'); + * in + * FilterComponent.php:216 + * This line adds the mock object as model class for DocumentCategory. + */ + ClassRegistry::addObject('document_category', new DocumentCategory()); + $this->Controller->filters = $testSettings; $this->Controller->Components->trigger('initialize', array($this->Controller));