RulesActionBaseTest.php in Rules 8.3
File
tests/src/Unit/RulesActionBaseTest.php
View source
<?php
namespace Drupal\Tests\rules\Unit;
use Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException;
use Drupal\Core\StringTranslation\TranslatableMarkup;
use Drupal\rules\Core\RulesActionBase;
class RulesActionBaseTest extends RulesUnitTestBase {
public function testSummaryThrowingException() {
$this
->expectException(InvalidPluginDefinitionException::class);
$rules_action_base = $this
->getMockForAbstractClass(RulesActionBase::class, [
[],
'',
'',
]);
$rules_action_base
->summary();
}
public function testSummaryParsingTheLabelAnnotation() {
$rules_action_base = $this
->getMockForAbstractClass(RulesActionBase::class, [
[],
'',
[
'label' => 'something',
],
]);
$this
->assertEquals('something', $rules_action_base
->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());
}
}