Skip to content

Commit

Permalink
fixed failing testCustomSelector test #3
Browse files Browse the repository at this point in the history
  • Loading branch information
gregor-j committed Jul 2, 2024
1 parent ce74bd0 commit 2047aab
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions Test/Case/Controller/Component/FilterComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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));
Expand Down

0 comments on commit 2047aab

Please sign in to comment.