function ConditionAccessResolverTraitTest::providerTestResolveConditions

Same name in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Condition/ConditionAccessResolverTraitTest.php \Drupal\Tests\Core\Condition\ConditionAccessResolverTraitTest::providerTestResolveConditions()
  2. 10 core/tests/Drupal/Tests/Core/Condition/ConditionAccessResolverTraitTest.php \Drupal\Tests\Core\Condition\ConditionAccessResolverTraitTest::providerTestResolveConditions()
  3. 11.x core/tests/Drupal/Tests/Core/Condition/ConditionAccessResolverTraitTest.php \Drupal\Tests\Core\Condition\ConditionAccessResolverTraitTest::providerTestResolveConditions()

File

core/tests/Drupal/Tests/Core/Condition/ConditionAccessResolverTraitTest.php, line 31

Class

ConditionAccessResolverTraitTest
@coversDefaultClass \Drupal\Core\Condition\ConditionAccessResolverTrait @group Condition

Namespace

Drupal\Tests\Core\Condition

Code

public function providerTestResolveConditions() {
    $data = [];
    $condition_true = $this->createMock('Drupal\\Core\\Condition\\ConditionInterface');
    $condition_true->expects($this->any())
        ->method('execute')
        ->willReturn(TRUE);
    $condition_false = $this->createMock('Drupal\\Core\\Condition\\ConditionInterface');
    $condition_false->expects($this->any())
        ->method('execute')
        ->willReturn(FALSE);
    $condition_exception = $this->createMock('Drupal\\Core\\Condition\\ConditionInterface');
    $condition_exception->expects($this->any())
        ->method('execute')
        ->will($this->throwException(new ContextException()));
    $condition_exception->expects($this->atLeastOnce())
        ->method('isNegated')
        ->willReturn(FALSE);
    $condition_negated = $this->createMock('Drupal\\Core\\Condition\\ConditionInterface');
    $condition_negated->expects($this->any())
        ->method('execute')
        ->will($this->throwException(new ContextException()));
    $condition_negated->expects($this->atLeastOnce())
        ->method('isNegated')
        ->willReturn(TRUE);
    $conditions = [];
    $data[] = [
        $conditions,
        'and',
        TRUE,
    ];
    $data[] = [
        $conditions,
        'or',
        FALSE,
    ];
    $conditions = [
        $condition_false,
    ];
    $data[] = [
        $conditions,
        'or',
        FALSE,
    ];
    $data[] = [
        $conditions,
        'and',
        FALSE,
    ];
    $conditions = [
        $condition_true,
    ];
    $data[] = [
        $conditions,
        'or',
        TRUE,
    ];
    $data[] = [
        $conditions,
        'and',
        TRUE,
    ];
    $conditions = [
        $condition_true,
        $condition_false,
    ];
    $data[] = [
        $conditions,
        'or',
        TRUE,
    ];
    $data[] = [
        $conditions,
        'and',
        FALSE,
    ];
    $conditions = [
        $condition_exception,
    ];
    $data[] = [
        $conditions,
        'or',
        FALSE,
    ];
    $data[] = [
        $conditions,
        'and',
        FALSE,
    ];
    $conditions = [
        $condition_true,
        $condition_exception,
    ];
    $data[] = [
        $conditions,
        'or',
        TRUE,
    ];
    $data[] = [
        $conditions,
        'and',
        FALSE,
    ];
    $conditions = [
        $condition_exception,
        $condition_true,
    ];
    $data[] = [
        $conditions,
        'or',
        TRUE,
    ];
    $data[] = [
        $conditions,
        'and',
        FALSE,
    ];
    $conditions = [
        $condition_false,
        $condition_exception,
    ];
    $data[] = [
        $conditions,
        'or',
        FALSE,
    ];
    $data[] = [
        $conditions,
        'and',
        FALSE,
    ];
    $conditions = [
        $condition_exception,
        $condition_false,
    ];
    $data[] = [
        $conditions,
        'or',
        FALSE,
    ];
    $data[] = [
        $conditions,
        'and',
        FALSE,
    ];
    $conditions = [
        $condition_negated,
    ];
    $data[] = [
        $conditions,
        'or',
        TRUE,
    ];
    $data[] = [
        $conditions,
        'and',
        TRUE,
    ];
    $conditions = [
        $condition_negated,
        $condition_negated,
    ];
    $data[] = [
        $conditions,
        'or',
        TRUE,
    ];
    $data[] = [
        $conditions,
        'and',
        TRUE,
    ];
    return $data;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.