You are here

public function PackageTest::testAppendDependency in Features 8.3

Same name and namespace in other branches
  1. 8.4 tests/src/Unit/PackageTest.php \Drupal\Tests\features\Unit\PackageTest::testAppendDependency()

@covers ::appendDependency

File

tests/src/Unit/PackageTest.php, line 39

Class

PackageTest
@coversDefaultClass \Drupal\features\Package @group features

Namespace

Drupal\Tests\features\Unit

Code

public function testAppendDependency() {
  $package = new Package('test_feature', []);
  $this
    ->assertEquals([], $package
    ->getDependencies());
  $dependencies = [
    'some_module',
    'my_module',
    'my_module',
    'test_feature',
  ];
  foreach ($dependencies as $dependency) {
    $package
      ->appendDependency($dependency);
  }

  // Test that duplicates are removed, results sorted, and the package cannot

  /// require itself.
  $expected = [
    'my_module',
    'some_module',
  ];
  $this
    ->assertEquals($expected, $package
    ->getDependencies());
}