You are here

private function RestrictIpAccessTest::createArticle in Restrict IP 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/RestrictIpAccessTest.php \Drupal\Tests\restrict_ip\Functional\RestrictIpAccessTest::createArticle()
  2. 3.x tests/src/Functional/RestrictIpAccessTest.php \Drupal\Tests\restrict_ip\Functional\RestrictIpAccessTest::createArticle()
4 calls to RestrictIpAccessTest::createArticle()
RestrictIpAccessTest::testAccessBypassByRole in tests/src/Functional/RestrictIpAccessTest.php
RestrictIpAccessTest::testBlacklistedPaths in tests/src/Functional/RestrictIpAccessTest.php
RestrictIpAccessTest::testRedirectToLoginWhenBypassByRoleEnabled in tests/src/Functional/RestrictIpAccessTest.php
RestrictIpAccessTest::testWhitelistedPaths in tests/src/Functional/RestrictIpAccessTest.php

File

tests/src/Functional/RestrictIpAccessTest.php, line 184

Class

RestrictIpAccessTest
@group restrict_ip

Namespace

Drupal\Tests\restrict_ip\Functional

Code

private function createArticle() {
  static $counter;
  if (!$counter) {
    $counter = 1;
  }
  $node = $this->container
    ->get('entity.manager')
    ->getStorage('node')
    ->create([
    'type' => 'article',
    'title' => 'Article ' . $counter,
  ]);
  $node
    ->save();
  $this->container
    ->get('router.builder')
    ->rebuild();
  $counter += 1;
}