public function MicrositeTest::testMicrositeEntity in Entity Reference Hierarchy 8.2
Same name and namespace in other branches
- 3.x modules/entity_hierarchy_microsite/tests/src/Kernel/MicrositeTest.php \Drupal\Tests\entity_hierarchy_microsite\Kernel\MicrositeTest::testMicrositeEntity()
Tests the microsite entity.
File
- modules/
entity_hierarchy_microsite/ tests/ src/ Kernel/ MicrositeTest.php, line 17
Class
- MicrositeTest
- Defines a class for testing the microsite entity.
Namespace
Drupal\Tests\entity_hierarchy_microsite\KernelCode
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());
}