Skip to content

Commit

Permalink
ENH Stop using Controller::has_curr()
Browse files Browse the repository at this point in the history
  • Loading branch information
emteknetnz committed Feb 13, 2025
1 parent ee61bd5 commit aa35a95
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions tests/php/VersionedGridFieldTest/TestController.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ protected function init()
public function __construct()
{
parent::__construct();
if (Controller::has_curr()) {
$this->setRequest(Controller::curr()->getRequest());
$controller = Controller::curr();
if ($controller) {
$this->setRequest($controller->getRequest());
}
}

Expand Down
7 changes: 4 additions & 3 deletions tests/php/VersionedTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1091,10 +1091,11 @@ public function testReadingNotPersistentWhenUseSessionFalse()

protected function setUp(): void
{
if (!static::$defaultController && Controller::has_curr()) {
static::$defaultController = Controller::curr();
$controller = Controller::curr();
if (!static::$defaultController && $controller) {
static::$defaultController = $controller;
}
if (!Controller::has_curr() && static::$defaultController) {
if (!$controller && static::$defaultController) {
static::$defaultController->pushCurrent();
}
parent::setUp();
Expand Down

0 comments on commit aa35a95

Please sign in to comment.