You are here

public function SkinrApiTestCase::testSkinrSkinHooks in Skinr 8.2

Test hook invocations for CRUD operations on skin configurations.

File

src/Tests/skinr.test, line 475
Tests for the Skinr module.

Class

SkinrApiTestCase
Tests API functionality.

Namespace

Drupal\tracker\Tests

Code

public function testSkinrSkinHooks() {
  $skin = (object) array(
    'theme' => 'skinr_test_subtheme',
    'module' => 'block',
    'element' => 'system__user-menu',
    'skin' => 'skinr_test_subtheme',
    'options' => array(
      'option1',
      'option2',
    ),
    'status' => 1,
  );
  $_SESSION['skinr_test'] = array();
  skinr_skin_save($skin);
  $this
    ->assertHookMessage('skinr_test_skinr_skin_presave called');
  $this
    ->assertHookMessage('skinr_test_skinr_skin_insert called');
  $_SESSION['skinr_test'] = array();
  $skin = entity_load('skin', $skin->sid);
  $this
    ->assertHookMessage('skinr_test_skinr_skin_load called');
  $_SESSION['skinr_test'] = array();
  $skin = entity_load('skin', $skin->sid, TRUE);
  $this
    ->assertHookMessage('skinr_test_entity_load called');
  $_SESSION['skinr_test'] = array();
  $skin->options = array(
    'option3',
  );
  skinr_skin_save($skin);
  $this
    ->assertHookMessage('skinr_test_skinr_skin_presave called');
  $this
    ->assertHookMessage('skinr_test_skinr_skin_update called');
  $_SESSION['skinr_test'] = array();
  $skin
    ->delete();
  $this
    ->assertHookMessage('skinr_test_entity_delete called');
}