You are here

public function InfoParserUnitTest::testInfoParserMissingKeys in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php \Drupal\Tests\Core\Extension\InfoParserUnitTest::testInfoParserMissingKeys()

Tests that missing required keys are detected.

@covers ::parse

@expectedException \Drupal\Core\Extension\InfoParserException @expectedExceptionMessageRegExp #Missing required keys \(type, core, name\) in .+?missing_keys\.info\.txt#

File

core/tests/Drupal/Tests/Core/Extension/InfoParserUnitTest.php, line 93
Contains \Drupal\Tests\Core\Extension\InfoParserUnitTest.

Class

InfoParserUnitTest
Tests InfoParser class and exception.

Namespace

Drupal\Tests\Core\Extension

Code

public function testInfoParserMissingKeys() {
  $missing_keys = <<<MISSINGKEYS
# info.yml for testing missing name, description, and type keys.
package: Core
version: VERSION
dependencies:
  - field
MISSINGKEYS;
  vfsStream::setup('modules');
  vfsStream::create([
    'fixtures' => [
      'missing_keys.info.txt' => $missing_keys,
    ],
  ]);
  $filename = vfsStream::url('modules/fixtures/missing_keys.info.txt');
  $this->infoParser
    ->parse($filename);
}