You are here

public function WardenManagerTest::testGenerateDataOneModule 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::testGenerateDataOneModule()
  2. 3.x tests/src/Unit/Service/WardenManagerTest.php \Drupal\Tests\warden\Unit\Service\WardenManagerTest::testGenerateDataOneModule()

Tests generating module data with one module.

File

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

Class

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

Namespace

Drupal\Tests\warden\Unit\Service

Code

public function testGenerateDataOneModule() {
  $expected_data = [
    'core' => [
      'drupal' => [
        'version' => \Drupal::VERSION,
      ],
    ],
    'contrib' => [
      'Module A' => [
        'version' => '8.x-1.0',
      ],
    ],
    'custom' => [],
    'url' => 'http://www.example.com',
    'site_name' => 'My Website',
    'key' => $this->token,
    'time' => 12345678,
  ];
  $this->wardenManager
    ->setModules([
    'module_a' => $this
      ->getMockExtension('module_a'),
  ]);
  $this->infoParser
    ->expects($this
    ->once())
    ->method('parse')
    ->with('modules/contrib/module_a/module_a.info.yml')
    ->willReturn([
    'project' => 'Module A',
    'version' => '8.x-1.0',
  ]);
  $actual_data = $this->wardenManager
    ->generateSiteData();
  $this
    ->assertEquals($expected_data, $actual_data);
}