You are here

protected function StubTestTrait::performStubTest in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/migrate_drupal/src/Tests/StubTestTrait.php \Drupal\migrate_drupal\Tests\StubTestTrait::performStubTest()

Test that creating a stub of the given entity type results in a valid entity.

Parameters

string $entity_type_id: The entity type we are stubbing.

10 calls to StubTestTrait::performStubTest()
MigrateAggregatorStubTest::testFeedStub in core/modules/aggregator/src/Tests/Migrate/MigrateAggregatorStubTest.php
Tests creation of aggregator feed stubs.
MigrateAggregatorStubTest::testItemStub in core/modules/aggregator/src/Tests/Migrate/MigrateAggregatorStubTest.php
Tests creation of aggregator feed items.
MigrateBlockContentStubTest::testStubSuccess in core/modules/block_content/src/Tests/Migrate/MigrateBlockContentStubTest.php
Tests creation of block content stubs when there is a block_content_type.
MigrateCommentStubTest::testStub in core/modules/comment/src/Tests/Migrate/MigrateCommentStubTest.php
Tests creation of comment stubs.
MigrateFileStubTest::testStub in core/modules/file/src/Tests/Migrate/MigrateFileStubTest.php
Tests creation of file stubs.

... See full list

File

core/modules/migrate_drupal/src/Tests/StubTestTrait.php, line 24
Contains \Drupal\migrate_drupal\Tests\StubTestTrait.

Class

StubTestTrait
Provides common functionality for testing stubbing.

Namespace

Drupal\migrate_drupal\Tests

Code

protected function performStubTest($entity_type_id) {
  $entity_id = $this
    ->createStub($entity_type_id);
  $this
    ->assertTrue($entity_id, 'Stub successfully created');
  if ($entity_id) {
    $violations = $this
      ->validateStub($entity_type_id, $entity_id);
    if (!$this
      ->assertIdentical(count($violations), 0, 'Stub is a valid entity')) {
      foreach ($violations as $violation) {
        $this
          ->fail((string) $violation
          ->getMessage());
      }
    }
  }
}