class RulesActionBaseTest in Rules 8.3
@coversDefaultClass \Drupal\rules\Core\RulesActionBase @group Rules
Hierarchy
- class \Drupal\Tests\UnitTestCase extends \PHPUnit\Framework\TestCase uses PhpunitCompatibilityTrait
- class \Drupal\Tests\rules\Unit\RulesUnitTestBase
- class \Drupal\Tests\rules\Unit\RulesActionBaseTest
- class \Drupal\Tests\rules\Unit\RulesUnitTestBase
Expanded class hierarchy of RulesActionBaseTest
File
- tests/
src/ Unit/ RulesActionBaseTest.php, line 13
Namespace
Drupal\Tests\rules\UnitView source
class RulesActionBaseTest extends RulesUnitTestBase {
/**
* Tests that a missing label throwa an exception.
*
* @covers ::summary
*/
public function testSummaryThrowingException() {
// Set the expected exception class. There is no message to check for.
$this
->expectException(InvalidPluginDefinitionException::class);
$rules_action_base = $this
->getMockForAbstractClass(RulesActionBase::class, [
[],
'',
'',
]);
$rules_action_base
->summary();
}
/**
* Tests that the summary is being parsed from the label annotation.
*
* @covers ::summary
*/
public function testSummaryParsingTheLabelAnnotation() {
$rules_action_base = $this
->getMockForAbstractClass(RulesActionBase::class, [
[],
'',
[
'label' => 'something',
],
]);
$this
->assertEquals('something', $rules_action_base
->summary());
}
/**
* Tests that a translation wrapper label is correctly parsed.
*
* @covers ::summary
*/
public function testTranslatedLabel() {
$translation_wrapper = $this
->prophesize(TranslatableMarkup::class);
$translation_wrapper
->__toString()
->willReturn('something');
$rules_action_base = $this
->getMockForAbstractClass(RulesActionBase::class, [
[],
'',
[
'label' => $translation_wrapper
->reveal(),
],
]);
$this
->assertEquals('something', $rules_action_base
->summary());
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
PhpunitCompatibilityTrait:: |
public | function | Returns a mock object for the specified class using the available method. | |
PhpunitCompatibilityTrait:: |
public | function | Compatibility layer for PHPUnit 6 to support PHPUnit 4 code. | |
RulesActionBaseTest:: |
public | function | Tests that the summary is being parsed from the label annotation. | |
RulesActionBaseTest:: |
public | function | Tests that a missing label throwa an exception. | |
RulesActionBaseTest:: |
public | function | Tests that a translation wrapper label is correctly parsed. | |
RulesUnitTestBase:: |
protected | property | The mocked expression manager object. | 1 |
RulesUnitTestBase:: |
protected | property | A mocked condition that always evaluates to FALSE. | |
RulesUnitTestBase:: |
protected | property | The mocked expression manager object. | |
RulesUnitTestBase:: |
protected | property | A mocked dummy action object. | |
RulesUnitTestBase:: |
protected | property | A mocked dummy action object. | |
RulesUnitTestBase:: |
protected | property | A mocked condition that always evaluates to TRUE. | |
RulesUnitTestBase:: |
protected | function |
Overrides UnitTestCase:: |
4 |
UnitTestCase:: |
protected | property | The random generator. | |
UnitTestCase:: |
protected | property | The app root. | 1 |
UnitTestCase:: |
protected | function | Asserts if two arrays are equal by sorting them first. | |
UnitTestCase:: |
protected | function | Mocks a block with a block plugin. | 1 |
UnitTestCase:: |
protected | function | Returns a stub class resolver. | |
UnitTestCase:: |
public | function | Returns a stub config factory that behaves according to the passed 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. |