class ConditionAccessResolverTraitTest in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/tests/Drupal/Tests/Core/Condition/ConditionAccessResolverTraitTest.php \Drupal\Tests\Core\Condition\ConditionAccessResolverTraitTest
@coversDefaultClass \Drupal\Core\Condition\ConditionAccessResolverTrait @group Condition
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \Drupal\Tests\PHPUnit_Framework_TestCase
- class \Drupal\Tests\Core\Condition\ConditionAccessResolverTraitTest
Expanded class hierarchy of ConditionAccessResolverTraitTest
File
- core/
tests/ Drupal/ Tests/ Core/ Condition/ ConditionAccessResolverTraitTest.php, line 17 - Contains \Drupal\Tests\Core\Condition\ConditionAccessResolverTraitTest.
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 = array();
$condition_true = $this
->getMock('Drupal\\Core\\Condition\\ConditionInterface');
$condition_true
->expects($this
->any())
->method('execute')
->will($this
->returnValue(TRUE));
$condition_false = $this
->getMock('Drupal\\Core\\Condition\\ConditionInterface');
$condition_false
->expects($this
->any())
->method('execute')
->will($this
->returnValue(FALSE));
$condition_exception = $this
->getMock('Drupal\\Core\\Condition\\ConditionInterface');
$condition_exception
->expects($this
->any())
->method('execute')
->will($this
->throwException(new ContextException()));
$conditions = array();
$data[] = array(
$conditions,
'and',
TRUE,
);
$data[] = array(
$conditions,
'or',
FALSE,
);
$conditions = array(
$condition_false,
);
$data[] = array(
$conditions,
'or',
FALSE,
);
$data[] = array(
$conditions,
'and',
FALSE,
);
$conditions = array(
$condition_true,
);
$data[] = array(
$conditions,
'or',
TRUE,
);
$data[] = array(
$conditions,
'and',
TRUE,
);
$conditions = array(
$condition_true,
$condition_false,
);
$data[] = array(
$conditions,
'or',
TRUE,
);
$data[] = array(
$conditions,
'and',
FALSE,
);
$conditions = array(
$condition_exception,
);
$data[] = array(
$conditions,
'or',
FALSE,
);
$data[] = array(
$conditions,
'and',
FALSE,
);
$conditions = array(
$condition_true,
$condition_exception,
);
$data[] = array(
$conditions,
'or',
TRUE,
);
$data[] = array(
$conditions,
'and',
FALSE,
);
$conditions = array(
$condition_exception,
$condition_true,
);
$data[] = array(
$conditions,
'or',
TRUE,
);
$data[] = array(
$conditions,
'and',
FALSE,
);
$conditions = array(
$condition_false,
$condition_exception,
);
$data[] = array(
$conditions,
'or',
FALSE,
);
$data[] = array(
$conditions,
'and',
FALSE,
);
$conditions = array(
$condition_exception,
$condition_false,
);
$data[] = array(
$conditions,
'or',
FALSE,
);
$data[] = array(
$conditions,
'and',
FALSE,
);
return $data;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConditionAccessResolverTraitTest:: |
public | function | ||
ConditionAccessResolverTraitTest:: |
public | function | Tests the resolveConditions() method. | |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed in array. | |
UnitTestCase:: |
public | function | Returns a stub config storage that returns the supplied configuration. | |
UnitTestCase:: |
protected | function | Sets up a container with a cache tags invalidator. | |
UnitTestCase:: |
protected | function | Gets the random generator for the utility methods. | |
UnitTestCase:: |
public | function | Returns a stub translation manager that just returns the passed string. | |
UnitTestCase:: |
public | function | Generates a unique random string containing letters and numbers. | |
UnitTestCase:: |
protected | function | 259 |