You are here

public function GridStackCrudTest::verifyGridStackOptionset in GridStack 8

Same name and namespace in other branches
  1. 8.2 tests/src/Kernel/GridStackCrudTest.php \Drupal\Tests\gridstack\Kernel\GridStackCrudTest::verifyGridStackOptionset()

Verifies that a gridstack optionset is properly stored.

Parameters

\Drupal\gridstack\Entity\GridStack $gridstack: The GridStack instance.

1 call to GridStackCrudTest::verifyGridStackOptionset()
GridStackCrudTest::testGridStackCrud in tests/src/Kernel/GridStackCrudTest.php
Tests CRUD operations for GridStack optionsets.

File

tests/src/Kernel/GridStackCrudTest.php, line 176

Class

GridStackCrudTest
Tests creation, loading, updating, deleting of GridStack optionsets.

Namespace

Drupal\Tests\gridstack\Kernel

Code

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

  // Verify the loaded gridstack has all properties.
  $gridstack = GridStack::load($gridstack
    ->id());
  $this
    ->assertEqual($gridstack
    ->id(), $gridstack
    ->id(), format_string('GridStack::load: Proper gridstack id for gridstack optionset %gridstack.', $t_args));
  $this
    ->assertEqual($gridstack
    ->label(), $gridstack
    ->label(), format_string('GridStack::load: Proper title for gridstack optionset %gridstack.', $t_args));

  // Check that the gridstack was created in site default language.
  $this
    ->assertEqual($gridstack
    ->language()
    ->getId(), $default_langcode, format_string('GridStack::load: Proper language code for gridstack optionset %gridstack.', $t_args));
}