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;
class MicrositeTest extends EntityHierarchyMicrositeKernelTestBase {
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());
}
}