module_instructions-2.0.x-dev/tests/src/Functional/ModuleInstructionsTests.php

tests/src/Functional/ModuleInstructionsTests.php
<?php

namespace Drupal\Tests\module_instructions\Functional;

use Drupal\Tests\BrowserTestBase;

/**
 * Class ModuleInstructionsTests. The base class for testing instructions.
 */
class ModuleInstructionsTests extends BrowserTestBase {

  /**
   * {@inheritdoc}
   */
  protected static $modules = ['module_instructions'];

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

  /**
   * Test module instructions.
   */
  public function testModuleInstructions() {
    // Log in as an admin user with permission to manage module instructions.
    $admin = $this->drupalCreateUser([], NULL, TRUE);
    $this->drupalLogin($admin);

    // Enable readme links.
    $config = \Drupal::configFactory()->getEditable('module_instructions.settings');
    $config->set('types', ['readme' => 'readme']);
    $config->save();

    drupal_flush_all_caches();

    // Check the status of the page.
    $this->drupalGet('/admin/modules');
    $this->assertSession()->statusCodeEquals(200);

    // Check if page contains Readme links.
    $this->assertSession()->linkExists('Readme');

    // Log in as an user user with permission to view module instructions.
    $user = $this->drupalCreateUser([
      'administer modules',
      'access module instruction files',
    ]);
    $this->drupalLogin($user);

    // Check the status of the page.
    $this->drupalGet('/admin/modules');
    $this->assertSession()->statusCodeEquals(200);

    // Check if page contains Readme links.
    $this->assertSession()->linkExists('Readme');
  }

}

Главная | Обратная связь

drupal hosting | друпал хостинг | it patrol .inc