You are here

class LogTemplateTest in Commerce Core 8.2

@coversDefaultClass \Drupal\commerce_log\Plugin\LogTemplate\LogTemplate @group commerce

Hierarchy

Expanded class hierarchy of LogTemplateTest

File

modules/log/tests/src/Unit/LogTemplateTest.php, line 12

Namespace

Drupal\Tests\commerce_log\Unit
View source
class LogTemplateTest extends UnitTestCase {

  /**
   * The log category.
   *
   * @var \Drupal\commerce_log\Plugin\LogTemplate\LogTemplateInterface
   */
  protected $logTemplate;

  /**
   * The plugin definition array.
   *
   * @var array
   */
  protected $definition = [
    'id' => 'entity_test',
    'label' => 'Entity Test Template',
    'category' => 'entity_test_group',
    'template' => '<p>Hello {{ message }}</p>',
  ];

  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    parent::setUp();
    $this->logTemplate = new LogTemplate([], 'order', $this->definition);
  }

  /**
   * @covers ::getId
   */
  public function testGetId() {
    $this
      ->assertEquals($this->definition['id'], $this->logTemplate
      ->getId());
  }

  /**
   * @covers ::getLabel
   */
  public function testGetLabel() {
    $this
      ->assertEquals($this->definition['label'], $this->logTemplate
      ->getLabel());
  }

  /**
   * @covers ::getGroup
   */
  public function getCategory() {
    $this
      ->assertEquals($this->definition['category'], $this->logTemplate
      ->getCategory());
  }

  /**
   * @covers ::getTemplate
   */
  public function getTemplate() {
    $this
      ->assertEquals($this->definition['template'], $this->logTemplate
      ->getTemplate());
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LogTemplateTest::$definition protected property The plugin definition array.
LogTemplateTest::$logTemplate protected property The log category.
LogTemplateTest::getCategory public function @covers ::getGroup
LogTemplateTest::getTemplate public function @covers ::getTemplate
LogTemplateTest::setUp protected function Overrides UnitTestCase::setUp
LogTemplateTest::testGetId public function @covers ::getId
LogTemplateTest::testGetLabel public function @covers ::getLabel
PhpunitCompatibilityTrait::getMock Deprecated public function Returns a mock object for the specified class using the available method.
PhpunitCompatibilityTrait::setExpectedException Deprecated public function Compatibility layer for PHPUnit 6 to support PHPUnit 4 code.
UnitTestCase::$randomGenerator protected property The random generator.
UnitTestCase::$root protected property The app root. 1
UnitTestCase::assertArrayEquals protected function Asserts if two arrays are equal by sorting them first.
UnitTestCase::getBlockMockWithMachineName Deprecated protected function Mocks a block with a block plugin. 1
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.