You are here

function TagadelicBlockTest::testTagadelicBlock in Tagadelic 8.3

Test block placement.

File

src/Tests/TagadelicBlockTest.php, line 25

Class

TagadelicBlockTest
Tests for displaying tagadelic block.

Namespace

Drupal\tagadelic\Tests

Code

function testTagadelicBlock() {

  // Create user.
  $web_user = $this
    ->drupalCreateUser(array(
    'administer blocks',
  ));

  // Login the admin user.
  $this
    ->drupalLogin($web_user);
  $theme_name = \Drupal::config('system.theme')
    ->get('default');

  // Verify the block is listed to be added.
  $this
    ->drupalGet('/admin/structure/block/library/' . $theme_name);
  $this
    ->assertRaw(t('Tagadelic tag cloud'), 'Block label found.');
  $settings = array(
    'label' => t('Tagadelic tag cloud test'),
    'id' => 'tagadelic_block',
    'theme' => $theme_name,
    'num_tags_block' => 5,
  );
  $this
    ->drupalPlaceBlock('tagadelic_block', $settings);

  // Verify that block is there.
  $this
    ->drupalGet('');
  $this
    ->assertRaw($settings['label'], 'Block found.');
}