You are here

protected function WardenManagerTest::expectContribModules in Warden 8

Same name and namespace in other branches
  1. 8.2 tests/src/Unit/Service/WardenManagerTest.php \Drupal\Tests\warden\Unit\Service\WardenManagerTest::expectContribModules()
  2. 3.x tests/src/Unit/Service/WardenManagerTest.php \Drupal\Tests\warden\Unit\Service\WardenManagerTest::expectContribModules()

Parameters

array $moduleNames: A list of module names (e.g. ['module_a', 'module_b'] The info parser will expect there to be 2 calls to parse and it will return an array each time of the form ['version' => '8.x-1.0']

1 call to WardenManagerTest::expectContribModules()
WardenManagerTest::testGenerateDataTwoModules in tests/src/Unit/Service/WardenManagerTest.php
Tests generating module data with two modules.

File

tests/src/Unit/Service/WardenManagerTest.php, line 123

Class

WardenManagerTest
@coversDefaultClass \Drupal\warden\Service\WardenManager @group warden

Namespace

Drupal\Tests\warden\Unit\Service

Code

protected function expectContribModules(array $moduleNames) {
  $results = [];
  foreach ($moduleNames as $moduleName) {
    $results["modules/contrib/{$moduleName}/{$moduleName}.info.yml"] = [
      'version' => '8.x-1.0',
    ];
  }
  $this->infoParser
    ->expects($this
    ->exactly(count($moduleNames)))
    ->method('parse')
    ->will($this
    ->returnCallback(function ($info_filename) use ($results) {
    return $results[$info_filename];
  }));
}