You are here

protected function NodeMatcherTest::setUp in Linkit 8.4

Sets up a Drupal site for running functional and integration tests.

Installs Drupal with the installation profile specified in \Drupal\simpletest\WebTestBase::$profile into the prefixed database.

Afterwards, installs any additional modules specified in the static \Drupal\simpletest\WebTestBase::$modules property of each class in the class hierarchy.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Overrides LinkitTestBase::setUp

File

src/Tests/Matchers/NodeMatcherTest.php, line 36
Contains \Drupal\linkit\Tests\Matchers\NodeMatcherTest.

Class

NodeMatcherTest
Tests node matcher.

Namespace

Drupal\linkit\Tests\Matchers

Code

protected function setUp() {
  parent::setUp();
  $this
    ->drupalLogin($this->adminUser);
  $this->manager = $this->container
    ->get('plugin.manager.linkit.matcher');
  $type1 = $this
    ->drupalCreateContentType([
    'type' => 'test1',
    'name' => 'Test1',
  ]);
  $type2 = $this
    ->drupalCreateContentType([
    'type' => 'test2',
    'name' => 'Test2',
  ]);

  // Nodes with type 1.
  $this
    ->drupalCreateNode([
    'title' => 'Lorem Ipsum 1',
    'type' => $type1
      ->id(),
  ]);
  $this
    ->drupalCreateNode([
    'title' => 'Lorem Ipsum 2',
    'type' => $type1
      ->id(),
  ]);

  // Nodes with type 1.
  $this
    ->drupalCreateNode([
    'title' => 'Lorem Ipsum 3',
    'type' => $type2
      ->id(),
  ]);

  // Unpublished node.
  $this
    ->drupalCreateNode([
    'title' => 'Lorem unpublishd',
    'type' => $type1
      ->id(),
    'status' => FALSE,
  ]);
}