Skip to content
Snippets Groups Projects

Issue #3119761: Replace multiple test methods in InfoParserUnitTest with 1 testInfoException and a dataprovider

Closed Issue #3119761: Replace multiple test methods in InfoParserUnitTest with 1 testInfoException and a dataprovider

Merge request reports

Merge request pipeline #98110 passed

Merge request pipeline passed for 97bcffea

Approval is optional
Code Quality is loading
Test summary results are being parsed

Closed by quietonequietone Mar 5, 2024 (Mar 5, 2024 1:11am UTC)

Merge details

  • The changes were not merged into 11.x.

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • 74 68 vfsStream::create([
    75 69 'fixtures' => [
    76 'broken.info.txt' => $broken_info,
    70 "broken.info.txt" => $yaml,
    71 "broken-duplicate.info.txt" => $yaml,
    77 72 ],
    78 73 ]);
    79 $filename = vfsStream::url('modules/fixtures/broken.info.txt');
    80 $this->expectException('\Drupal\Core\Extension\InfoParserException');
    81 $this->expectExceptionMessage('broken.info.txt');
    82 $this->infoParser->parse($filename);
    74
    75 $exception_message = "$expected_exception_message vfs://modules/fixtures/broken";
    76 // Set the expected exception for the second call to parse().
    77 $this->expectException(InfoParserException::class);
    78 $this->expectExceptionMessage($exception_message . '-duplicate.info.txt');
  • 65 public function testInfoException($yaml, $expected_exception_message): void {
    72 66
    73 67 vfsStream::setup('modules');
    74 68 vfsStream::create([
    75 69 'fixtures' => [
    76 'broken.info.txt' => $broken_info,
    70 "broken.info.txt" => $yaml,
    71 "broken-duplicate.info.txt" => $yaml,
    77 72 ],
    78 73 ]);
    79 $filename = vfsStream::url('modules/fixtures/broken.info.txt');
    80 $this->expectException('\Drupal\Core\Extension\InfoParserException');
    81 $this->expectExceptionMessage('broken.info.txt');
    82 $this->infoParser->parse($filename);
    74
    75 $exception_message = "$expected_exception_message vfs://modules/fixtures/broken";
  • 137 package: Core
    138 version: VERSION
    139 core_version_requirement: '*'
    140 dependencies::;;
    141 - field
    142 BROKEN_INFO;
    125 143
    126 144 vfsStream::setup('modules');
    127 145 vfsStream::create([
    128 146 'fixtures' => [
    129 'missing_core_version_requirement.info.txt' => $missing_core_version_requirement,
    130 'missing_core_version_requirement-duplicate.info.txt' => $missing_core_version_requirement,
    147 'broken.info.txt' => $broken_info,
    131 148 ],
    132 149 ]);
    133 150 $exception_message = "The 'core_version_requirement' key must be present in vfs://modules/fixtures/missing_core_version_requirement";
  • 78 73 ]);
    79 $filename = vfsStream::url('modules/fixtures/broken.info.txt');
    80 $this->expectException('\Drupal\Core\Extension\InfoParserException');
    81 $this->expectExceptionMessage('broken.info.txt');
    82 $this->infoParser->parse($filename);
    74
    75 $exception_message = "$expected_exception_message vfs://modules/fixtures/broken";
    76 // Set the expected exception for the second call to parse().
    77 $this->expectException(InfoParserException::class);
    78 $this->expectExceptionMessage($exception_message . '-duplicate.info.txt');
    79 try {
    80 $this->infoParser->parse(vfsStream::url("modules/fixtures/broken.info.txt"));
    81 }
    82 catch (InfoParserException $exception) {
    83 $this->assertSame($exception_message . '.info.txt', $exception->getMessage());
    84 $this->infoParser->parse(vfsStream::url("modules/fixtures/broken-duplicate.info.txt"));
  • 138 version: VERSION
    139 core_version_requirement: '*'
    140 dependencies::;;
    141 - field
    142 BROKEN_INFO;
    125 143
    126 144 vfsStream::setup('modules');
    127 145 vfsStream::create([
    128 146 'fixtures' => [
    129 'missing_core_version_requirement.info.txt' => $missing_core_version_requirement,
    130 'missing_core_version_requirement-duplicate.info.txt' => $missing_core_version_requirement,
    147 'broken.info.txt' => $broken_info,
    131 148 ],
    132 149 ]);
    133 150 $exception_message = "The 'core_version_requirement' key must be present in vfs://modules/fixtures/missing_core_version_requirement";
    134 151 // Set the expected exception for the 2nd call to parse().
  • Derek Wright added 281 commits

    added 281 commits

    Compare with previous version

  • 82 catch (InfoParserException $exception) {
    83 $this->assertSame($exception_message . '.info.txt', $exception->getMessage());
    84 $this->infoParser->parse(vfsStream::url("modules/fixtures/broken-duplicate.info.txt"));
    85 }
    83 86 }
    84 87
    85 88 /**
    86 * Tests that missing required keys are detected.
    87 *
    88 * @covers ::parse
    89 * Data provider for testInfoException().
    89 90 */
    90 public function testInfoParserMissingKeys() {
    91 $missing_keys = <<<MISSING_KEYS
    92 # info.yml for testing missing name, description, and type keys.
    91 public function providerInfoException(): array {
  • Derek Wright added 2 commits

    added 2 commits

    Compare with previous version

  • closed

  • Please register or sign in to reply
    Loading