Skip to content

Commit

Permalink
EZP-32281: IndexRequestListener requires redirect (#161)
Browse files Browse the repository at this point in the history
* EZP-32281: IndexRequestListener requires redirect

* EZP-32281: Fixed unit test

Co-authored-by: Bartek Wajda <bartlomiej.wajda@ibexa.co>
  • Loading branch information
Bartek and barw4 authored Jan 20, 2021
1 parent 8a50b15 commit 13bf926
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function onKernelRequestIndex(RequestEvent $event)
if ($indexPage !== null) {
$indexPage = '/' . ltrim($indexPage, '/');
$request->attributes->set('semanticPathinfo', $indexPage);
$request->attributes->set('needsForward', true);
$request->attributes->set('needsRedirect', true);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function testOnKernelRequestIndexOnIndexPage($requestPath, $configuredInd
$this->request->attributes->set('semanticPathinfo', $requestPath);
$this->indexRequestEventListener->onKernelRequestIndex($this->event);
$this->assertEquals($expectedIndexPath, $this->request->attributes->get('semanticPathinfo'));
$this->assertTrue($this->request->attributes->get('needsForward'));
$this->assertTrue($this->request->attributes->get('needsRedirect'));
}

public function indexPageProvider()
Expand All @@ -97,6 +97,6 @@ public function testOnKernelRequestIndexNotOnIndexPage()
{
$this->request->attributes->set('semanticPathinfo', '/anyContent');
$this->indexRequestEventListener->onKernelRequestIndex($this->event);
$this->assertFalse($this->request->attributes->has('needsForward'));
$this->assertFalse($this->request->attributes->has('needsRedirect'));
}
}

0 comments on commit 13bf926

Please # to comment.