You are here

public function DependencyTest::testCreateFromString in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/Core/Extension/DependencyTest.php \Drupal\Tests\Core\Extension\DependencyTest::testCreateFromString()
  2. 9 core/tests/Drupal/Tests/Core/Extension/DependencyTest.php \Drupal\Tests\Core\Extension\DependencyTest::testCreateFromString()

@covers ::createFromString @dataProvider providerCreateFromString

File

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

Class

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

Namespace

Drupal\Tests\Core\Extension

Code

public function testCreateFromString($string, $expected_name, $expected_project, $expected_constraint) {
  $dependency = Dependency::createFromString($string);
  $this
    ->assertSame($expected_name, $dependency
    ->getName());
  $this
    ->assertSame($expected_project, $dependency
    ->getProject());
  $this
    ->assertSame($expected_constraint, $dependency
    ->getConstraintString());
}