class ConditionAccessResolverTraitTest
@coversDefaultClass \Drupal\Core\Condition\ConditionAccessResolverTrait
      
    
@group Condition
Hierarchy
- class \Drupal\Tests\UnitTestCase uses \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\Tests\Core\Condition\ConditionAccessResolverTraitTest extends \Drupal\Tests\UnitTestCase
 
 
Expanded class hierarchy of ConditionAccessResolverTraitTest
File
- 
              core/
tests/ Drupal/ Tests/ Core/ Condition/ ConditionAccessResolverTraitTest.php, line 17  
Namespace
Drupal\Tests\Core\ConditionView source
class ConditionAccessResolverTraitTest extends UnitTestCase {
  
  /**
   * Tests the resolveConditions() method.
   *
   * @covers ::resolveConditions
   *
   * @dataProvider providerTestResolveConditions
   */
  public function testResolveConditions($conditions, $logic, $expected) {
    $trait_object = new TestConditionAccessResolverTrait();
    $this->assertEquals($expected, $trait_object->resolveConditions($conditions, $logic));
  }
  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;
  }
}
Members
| Title Sort descending | Deprecated | Modifiers | Object type | Summary | Overrides | 
|---|---|---|---|---|---|
| ConditionAccessResolverTraitTest::providerTestResolveConditions | public | function | |||
| ConditionAccessResolverTraitTest::testResolveConditions | public | function | Tests the resolveConditions() method. | ||
| PhpUnitWarnings::$deprecationWarnings | private static | property | Deprecation warnings from PHPUnit to raise with @trigger_error(). | ||
| PhpUnitWarnings::addWarning | public | function | Converts PHPUnit deprecation warnings to E_USER_DEPRECATED. | ||
| UnitTestCase::$randomGenerator | protected | property | The random generator. | ||
| UnitTestCase::$root | protected | property | The app root. | 1 | |
| UnitTestCase::assertArrayEquals | Deprecated | protected | function | Asserts if two arrays are equal by sorting them first. | |
| UnitTestCase::getClassResolverStub | protected | function | Returns a stub class resolver. | ||
| UnitTestCase::getConfigFactoryStub | public | function | Returns a stub config factory that behaves according to the passed array. | ||
| UnitTestCase::getConfigStorageStub | public | function | Returns a stub config storage that returns the supplied configuration. | ||
| UnitTestCase::getContainerWithCacheTagsInvalidator | protected | function | Sets up a container with a cache tags invalidator. | ||
| UnitTestCase::getRandomGenerator | protected | function | Gets the random generator for the utility methods. | ||
| UnitTestCase::getStringTranslationStub | public | function | Returns a stub translation manager that just returns the passed string. | ||
| UnitTestCase::randomMachineName | public | function | Generates a unique random string containing letters and numbers. | ||
| UnitTestCase::setUp | protected | function | 338 | ||
| UnitTestCase::setUpBeforeClass | public static | function | 
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.