You are here

public function ModuleVersionTest::providerVersionInfos in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/update/tests/src/Unit/ModuleVersionTest.php \Drupal\Tests\update\Unit\ModuleVersionTest::providerVersionInfos()

Data provider for expected version information.

Return value

array Arrays of version information.

File

core/modules/update/tests/src/Unit/ModuleVersionTest.php, line 51

Class

ModuleVersionTest
@coversDefaultClass \Drupal\update\ModuleVersion

Namespace

Drupal\Tests\update\Unit

Code

public function providerVersionInfos() {

  // Data provider values are:
  // - The version number to test.
  // - Array of expected version information with the following keys:
  //   -'major': The expected result from ::getMajorVersion().
  //   -'extra': The expected result from ::getVersionExtra().
  return [
    '8.x-1.3' => [
      '8.x-1.3',
      [
        'major' => '1',
        'extra' => NULL,
      ],
    ],
    '8.x-1.0' => [
      '8.x-1.0',
      [
        'major' => '1',
        'extra' => NULL,
      ],
    ],
    '8.x-1.0-alpha1' => [
      '8.x-1.0-alpha1',
      [
        'major' => '1',
        'extra' => 'alpha1',
      ],
    ],
    '8.x-1.3-alpha1' => [
      '8.x-1.3-alpha1',
      [
        'major' => '1',
        'extra' => 'alpha1',
      ],
    ],
    '0.1' => [
      '0.1',
      [
        'major' => '0',
        'extra' => NULL,
      ],
    ],
    '1.0' => [
      '1.0',
      [
        'major' => '1',
        'extra' => NULL,
      ],
    ],
    '1.3' => [
      '1.3',
      [
        'major' => '1',
        'extra' => NULL,
      ],
    ],
    '1.0-alpha1' => [
      '1.0-alpha1',
      [
        'major' => '1',
        'extra' => 'alpha1',
      ],
    ],
    '1.3-alpha1' => [
      '1.3-alpha1',
      [
        'major' => '1',
        'extra' => 'alpha1',
      ],
    ],
    '0.2.0' => [
      '0.2.0',
      [
        'major' => '0',
        'extra' => NULL,
      ],
    ],
    '1.2.0' => [
      '1.2.0',
      [
        'major' => '1',
        'extra' => NULL,
      ],
    ],
    '1.0.3' => [
      '1.0.3',
      [
        'major' => '1',
        'extra' => NULL,
      ],
    ],
    '1.2.3' => [
      '1.2.3',
      [
        'major' => '1',
        'extra' => NULL,
      ],
    ],
    '1.2.0-alpha1' => [
      '1.2.0-alpha1',
      [
        'major' => '1',
        'extra' => 'alpha1',
      ],
    ],
    '1.2.3-alpha1' => [
      '1.2.3-alpha1',
      [
        'major' => '1',
        'extra' => 'alpha1',
      ],
    ],
    '8.x-1.x-dev' => [
      '8.x-1.x-dev',
      [
        'major' => '1',
        'extra' => 'dev',
      ],
    ],
    '8.x-8.x-dev' => [
      '8.x-8.x-dev',
      [
        'major' => '8',
        'extra' => 'dev',
      ],
    ],
    '1.x-dev' => [
      '1.x-dev',
      [
        'major' => '1',
        'extra' => 'dev',
      ],
    ],
    '8.x-dev' => [
      '8.x-dev',
      [
        'major' => '8',
        'extra' => 'dev',
      ],
    ],
    '1.0.x-dev' => [
      '1.0.x-dev',
      [
        'major' => '1',
        'extra' => 'dev',
      ],
    ],
    '1.2.x-dev' => [
      '1.2.x-dev',
      [
        'major' => '1',
        'extra' => 'dev',
      ],
    ],
  ];
}