Skip to content

Commit

Permalink
[TASK] Avoid superfluous Reflection invocation in tests
Browse files Browse the repository at this point in the history
Resolves: #90086
Releases: master, 9.5
Change-Id: Ibe5eb0db866933984a07ac5f5b82010a0ae4698b
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62845
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Daniel Goerz <daniel.goerz@posteo.de>
Reviewed-by: Daniel Goerz <daniel.goerz@posteo.de>
  • Loading branch information
ohader authored and ervaude committed Jan 14, 2020
1 parent 04d8ada commit 47b9dee
Showing 1 changed file with 9 additions and 25 deletions.
Expand Up @@ -16,7 +16,6 @@
*/

use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\Arguments;
use TYPO3\CMS\Extbase\Mvc\Web\Request;
use TYPO3\CMS\Extbase\Mvc\Web\Response;
use TYPO3\CMS\Extbase\Object\ObjectManager;
Expand Down Expand Up @@ -63,6 +62,12 @@ protected function setUp()
$this->controller = $objectManager->get(Fixture\Controller\TestController::class);
}

protected function tearDown()
{
unset($this->request, $this->response, $this->controller);
parent::tearDown();
}

/**
* @test
*/
Expand All @@ -75,15 +80,8 @@ public function modelValidatorsAreProperlyResolved()
// Test run
$this->controller->processRequest($this->request, $this->response);

// Open arguments property
$reflectionClass = new \ReflectionClass($this->controller);
$argumentsProperty = $reflectionClass->getProperty('arguments');
$argumentsProperty->setAccessible(true);

// Assertions

/** @var Arguments $arguments */
$arguments = $argumentsProperty->getValue($this->controller);
$arguments = $this->controller->getControllerContext()->getArguments();
$argument = $arguments->getArgument('fooParam');

/** @var ConjunctionValidator $validator */
Expand Down Expand Up @@ -120,15 +118,8 @@ public function customValidatorsAreProperlyResolved()
// Test run
$this->controller->processRequest($this->request, $this->response);

// Open arguments property
$reflectionClass = new \ReflectionClass($this->controller);
$argumentsProperty = $reflectionClass->getProperty('arguments');
$argumentsProperty->setAccessible(true);

// Assertions

/** @var Arguments $arguments */
$arguments = $argumentsProperty->getValue($this->controller);
$arguments = $this->controller->getControllerContext()->getArguments();
$argument = $arguments->getArgument('barParam');

/** @var ConjunctionValidator $validator */
Expand Down Expand Up @@ -168,15 +159,8 @@ public function extbaseValidatorsAreProperlyResolved()
// Test run
$this->controller->processRequest($this->request, $this->response);

// Open arguments property
$reflectionClass = new \ReflectionClass($this->controller);
$argumentsProperty = $reflectionClass->getProperty('arguments');
$argumentsProperty->setAccessible(true);

// Assertions

/** @var Arguments $arguments */
$arguments = $argumentsProperty->getValue($this->controller);
$arguments = $this->controller->getControllerContext()->getArguments();
$argument = $arguments->getArgument('bazParam');

/** @var ConjunctionValidator $validator */
Expand Down

0 comments on commit 47b9dee

Please sign in to comment.