You are here

public function MigrateCommentStubTest::testStub in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/comment/src/Tests/Migrate/MigrateCommentStubTest.php \Drupal\comment\Tests\Migrate\MigrateCommentStubTest::testStub()

Tests creation of comment stubs.

File

core/modules/comment/src/Tests/Migrate/MigrateCommentStubTest.php, line 62
Contains \Drupal\comment\Tests\Migrate\MigrateCommentStubTest.

Class

MigrateCommentStubTest
Test stub creation for comment entities.

Namespace

Drupal\comment\Tests\Migrate

Code

public function testStub() {
  try {

    // We expect an exception, because there's no node to reference.
    $this
      ->performStubTest('comment');
    $this
      ->fail('Expected exception has not been thrown.');
  } catch (MigrateException $e) {
    $this
      ->assertIdentical($e
      ->getMessage(), 'Stubbing failed, unable to generate value for field entity_id');
  }

  // The stub should pass when there's a node to point to.
  $this
    ->createStub('node');
  $this
    ->performStubTest('comment');
}