You are here

public function BundleEntityDuplicatorTest::testDuplicate in Entity API 8

@covers ::duplicate

File

tests/src/Kernel/BundleEntityDuplicatorTest.php, line 79

Class

BundleEntityDuplicatorTest
Tests the bundle entity duplicator.

Namespace

Drupal\Tests\entity\Kernel

Code

public function testDuplicate() {
  $duplicated_bundle_entity = $this->duplicator
    ->duplicate($this->bundleEntity, [
    'id' => 'test2',
    'label' => 'Test2',
  ]);
  $this
    ->assertFalse($duplicated_bundle_entity
    ->isNew());
  $this
    ->assertEquals('test2', $duplicated_bundle_entity
    ->id());
  $this
    ->assertEquals('Test2', $duplicated_bundle_entity
    ->label());
  $this
    ->assertEquals($this->bundleEntity
    ->get('description'), $duplicated_bundle_entity
    ->get('description'));
}