You are here

public function ExporterIntegrationTest::testModuleExportException in Default Content for D8 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Kernel/ExporterIntegrationTest.php \Drupal\Tests\default_content\Kernel\ExporterIntegrationTest::testModuleExportException()

Tests exportModuleContent()

File

tests/src/Kernel/ExporterIntegrationTest.php, line 286

Class

ExporterIntegrationTest
Tests export functionality.

Namespace

Drupal\Tests\default_content\Kernel

Code

public function testModuleExportException() {
  \Drupal::service('module_installer')
    ->install([
    'node',
    'default_content',
    'default_content_export_test',
  ]);
  \Drupal::service('router.builder')
    ->rebuild();
  $this->defaultContentManager = \Drupal::service('default_content.exporter');
  $this
    ->expectException(\InvalidArgumentException::class);
  $this
    ->expectExceptionMessage(sprintf('Entity "%s" with UUID "%s" does not exist', 'node', '0e45d92f-1919-47cd-8b60-964a8a761292'));

  // Should throw an exception for missing uuid for the testing module.
  $this->defaultContentManager
    ->exportModuleContent('default_content_export_test');
}