You are here

public function EntityCloneViewTest::testViewEntityClone in Entity Clone 8

Test view entity clone.

File

tests/src/Functional/EntityCloneViewTest.php, line 57

Class

EntityCloneViewTest
Create a view and test a clone.

Namespace

Drupal\Tests\entity_clone\Functional

Code

public function testViewEntityClone() {
  $edit = [
    'id' => 'test_view_cloned',
    'label' => 'Test view cloned',
  ];
  $this
    ->drupalPostForm('entity_clone/view/who_s_new', $edit, t('Clone'));
  $views = \Drupal::entityTypeManager()
    ->getStorage('view')
    ->loadByProperties([
    'id' => $edit['id'],
  ]);
  $view = reset($views);
  $this
    ->assertInstanceOf(View::class, $view, 'Test default view cloned found in database.');
}