Skip to content

Commit

Permalink
CS
Browse files Browse the repository at this point in the history
  • Loading branch information
leofeyer committed Dec 7, 2020
1 parent 00eeb72 commit 29ea202
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions core-bundle/src/HttpKernel/ModelArgumentResolver.php
Expand Up @@ -82,10 +82,10 @@ private function fetchModel(Request $request, ArgumentMetadata $argument): ?Mode

// Special handling for pageModel that could be globally registered
if (
is_a($type, PageModel::class, true)
&& isset($GLOBALS['objPage'])
isset($GLOBALS['objPage'])
&& $GLOBALS['objPage'] instanceof PageModel
&& (int) $GLOBALS['objPage']->id === (int) $value
&& is_a($type, PageModel::class, true)
) {
return $GLOBALS['objPage'];
}
Expand Down
10 changes: 3 additions & 7 deletions core-bundle/tests/HttpKernel/ModelArgumentResolverTest.php
Expand Up @@ -23,18 +23,13 @@

class ModelArgumentResolverTest extends TestCase
{
protected function setUp(): void
{
parent::setUp();

unset($GLOBALS);
}

/**
* @dataProvider getArguments
*/
public function testResolvesTheModel(string $name, string $class): void
{
unset($GLOBALS['objPage']);

System::setContainer($this->getContainerWithContaoConfiguration());

$pageModel = $this->createMock(PageModel::class);
Expand Down Expand Up @@ -175,6 +170,7 @@ public function testReturnsTheGlobalPageModel(): void
->expects($this->once())
->method('initialize')
;

$framework
->expects($this->never())
->method('getAdapter')
Expand Down

0 comments on commit 29ea202

Please sign in to comment.