Skip to content

Commit

Permalink
[BUGFIX] Fix tests in ConditionMatcher regarding applicationContext
Browse files Browse the repository at this point in the history
The applicationContext tests were only checking
the string "applicationContext" and not the actual
object that was injected by the provider.

The change adapts the tests to make them actually
useful.

Resolves: #89612
Releases: master, 9.5
Change-Id: I1a155fa81817d42a8b4bd2ce853e0a0ed863c3e2
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/62243
Tested-by: Frank Nägler <frank.naegler@typo3.org>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Frank Nägler <frank.naegler@typo3.org>
Reviewed-by: Benni Mack <benni@typo3.org>
  • Loading branch information
bmack committed Nov 8, 2019
1 parent cb2c681 commit cb43712
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,11 @@ public function evaluateConditionCommonReturnsTrueForMatchingContexts($matchingC
/** @var ApplicationContext $applicationContext */
$applicationContext = new ApplicationContext('Production/Staging/Server2');
Fixtures\GeneralUtilityFixture::setApplicationContext($applicationContext);
$this->initConditionMatcher();

// Test expression language
self::assertTrue(
$this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['like("' . $applicationContext . '", "' . preg_quote($matchingContextCondition, '/') . '")'])
$this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['like(applicationContext, "' . preg_quote($matchingContextCondition, '/') . '")'])
);
}

Expand Down Expand Up @@ -285,10 +286,11 @@ public function evaluateConditionCommonReturnsNullForNotMatchingApplicationConte
/** @var ApplicationContext $applicationContext */
$applicationContext = new ApplicationContext('Production/Staging/Server2');
Fixtures\GeneralUtilityFixture::setApplicationContext($applicationContext);
$this->initConditionMatcher();

// Test expression language
self::assertFalse(
$this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['like("' . $applicationContext . '", "' . preg_quote($notMatchingApplicationContextCondition, '/') . '")'])
$this->evaluateExpressionMethod->invokeArgs($this->conditionMatcher, ['like(applicationContext, "' . preg_quote($notMatchingApplicationContextCondition, '/') . '")'])
);
}

Expand Down

0 comments on commit cb43712

Please sign in to comment.