You are here

public function SlickCrudTest::verifySlickOptionset in Slick Carousel 8.2

Same name and namespace in other branches
  1. 8 tests/src/Kernel/SlickCrudTest.php \Drupal\Tests\slick\Kernel\SlickCrudTest::verifySlickOptionset()

Verifies that a slick optionset is properly stored.

Parameters

\Drupal\slick\Entity\Slick $slick: The Slick instance.

1 call to SlickCrudTest::verifySlickOptionset()
SlickCrudTest::testSlickCrud in tests/src/Kernel/SlickCrudTest.php
Tests CRUD operations for Slick optionsets.

File

tests/src/Kernel/SlickCrudTest.php, line 210

Class

SlickCrudTest
Tests creation, loading, updating, deleting of Slick optionsets.

Namespace

Drupal\Tests\slick\Kernel

Code

public function verifySlickOptionset(Slick $slick) {
  $t_args = [
    '%slick' => $slick
      ->label(),
  ];
  $default_langcode = \Drupal::languageManager()
    ->getDefaultLanguage()
    ->getId();

  // Verify the loaded slick has all properties.
  $slick = Slick::load($slick
    ->id());
  $this
    ->assertEquals($slick
    ->id(), $slick
    ->id(), new FormattableMarkup('Slick::load: Proper slick id for slick optionset %slick.', $t_args));
  $this
    ->assertEquals($slick
    ->label(), $slick
    ->label(), new FormattableMarkup('Slick::load: Proper title for slick optionset %slick.', $t_args));

  // Check that the slick was created in site default language.
  $this
    ->assertEquals($slick
    ->language()
    ->getId(), $default_langcode, new FormattableMarkup('Slick::load: Proper language code for slick optionset %slick.', $t_args));
}