You are here

public function DependencyTest::testOffsetGet in Drupal 8

@covers ::offsetGet @group legacy @expectedDeprecation Array access to the Drupal\Core\Extension\Dependency name property is deprecated. Use Drupal\Core\Extension\Dependency::getName() instead. See https://www.drupal.org/node/2756875 @expectedDeprecation Array access to the Drupal\Core\Extension\Dependency project property is deprecated. Use Drupal\Core\Extension\Dependency::getProject() instead. See https://www.drupal.org/node/2756875 @expectedDeprecation Array access to the Drupal\Core\Extension\Dependency original_version property is deprecated. Use Drupal\Core\Extension\Dependency::getConstraintString() instead. See https://www.drupal.org/node/2756875 @expectedDeprecation Array access to the Drupal\Core\Extension\Dependency versions property is deprecated. See https://www.drupal.org/node/2756875

File

core/tests/Drupal/Tests/Core/Extension/DependencyTest.php, line 66

Class

DependencyTest
@coversDefaultClass \Drupal\Core\Extension\Dependency @group Extension

Namespace

Drupal\Tests\Core\Extension

Code

public function testOffsetGet() {
  $dependency = new Dependency('views', 'drupal', '>8.x-1.1');
  $this
    ->assertSame('views', $dependency['name']);
  $this
    ->assertSame('drupal', $dependency['project']);
  $this
    ->assertSame(' (>8.x-1.1)', $dependency['original_version']);
  $this
    ->assertSame([
    [
      'op' => '>',
      'version' => '1.1',
    ],
  ], $dependency['versions']);
}