You are here

MicrositeTest.php in Entity Reference Hierarchy 8.2

File

modules/entity_hierarchy_microsite/tests/src/Kernel/MicrositeTest.php
View source
<?php

namespace Drupal\Tests\entity_hierarchy_microsite\Kernel;

use Drupal\entity_hierarchy_microsite\Entity\Microsite;

/**
 * Defines a class for testing the microsite entity.
 *
 * @group entity_hierarchy_microsite
 */
class MicrositeTest extends EntityHierarchyMicrositeKernelTestBase {

  /**
   * Tests the microsite entity.
   */
  public function testMicrositeEntity() {
    $media = $this
      ->createImageMedia();
    $microsite = Microsite::create([
      'name' => 'Subsite',
      'home' => $this->parent,
      'logo' => $media,
    ]);
    $microsite
      ->save();
    $this
      ->assertEquals('Subsite', $microsite
      ->label());
    $this
      ->assertEquals($this->parent
      ->id(), $microsite
      ->getHome()
      ->id());
    $this
      ->assertEquals($media
      ->id(), $microsite
      ->getLogo()
      ->id());
  }

}

Classes

Namesort descending Description
MicrositeTest Defines a class for testing the microsite entity.