You are here

protected function CreatePhotosAlbumTest::setUp in Album Photos 8.4

Same name and namespace in other branches
  1. 8.5 tests/src/Kernel/CreatePhotosAlbumTest.php \Drupal\Tests\photos\Kernel\CreatePhotosAlbumTest::setUp()
  2. 6.0.x tests/src/Kernel/CreatePhotosAlbumTest.php \Drupal\Tests\photos\Kernel\CreatePhotosAlbumTest::setUp()

Overrides EntityKernelTestBase::setUp

File

tests/src/Kernel/CreatePhotosAlbumTest.php, line 34

Class

CreatePhotosAlbumTest
Tests creating photo album node.

Namespace

Drupal\Tests\photos\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installConfig([
    'system',
  ]);
  $this
    ->installEntitySchema('file');
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('node');
  $this
    ->installSchema('file', [
    'file_usage',
  ]);
  $this
    ->installSchema('photos', [
    'photos_album',
    'photos_image',
    'photos_comment',
    'photos_node',
    'photos_count',
  ]);

  // Make sure that a user with uid 1 exists.
  $user = User::create([
    'uid' => 1,
    'name' => $this
      ->randomMachineName(),
  ]);
  $user
    ->enforceIsNew();
  $user
    ->save();
  \Drupal::currentUser()
    ->setAccount($user);
}