function PathHasAliasTest::testConditionEvaluationPathWithoutAlias
Tests evaluating the condition for path without an alias.
@covers ::evaluate
File
-
tests/
src/ Unit/ Integration/ Condition/ PathHasAliasTest.php, line 93
Class
- PathHasAliasTest
- @coversDefaultClass \Drupal\rules\Plugin\Condition\PathHasAlias @group RulesCondition
Namespace
Drupal\Tests\rules\Unit\Integration\ConditionCode
public function testConditionEvaluationPathWithoutAlias() {
// If the alias does not exist, getAliasByPath() should return the path.
$this->aliasManager
->getAliasByPath('/path-without-alias', NULL)
->willReturn('/path-without-alias')
->shouldBeCalledTimes(1);
$this->aliasManager
->getAliasByPath('/path-without-alias', 'en')
->willReturn('/path-without-alias')
->shouldBeCalledTimes(1);
// First, only set the path context.
$this->condition
->setContextValue('path', '/path-without-alias');
// Test without language context set.
$this->assertFalse($this->condition
->evaluate());
// Test with language context set.
$this->condition
->setContextValue('language', $this->englishLanguage
->reveal());
$this->assertFalse($this->condition
->evaluate());
}