diff --git a/core/modules/system/lib/Drupal/system/Tests/Graph/GraphUnitTest.php b/core/tests/Drupal/Tests/Component/Graph/GraphUnitTest.php similarity index 79% rename from core/modules/system/lib/Drupal/system/Tests/Graph/GraphUnitTest.php rename to core/tests/Drupal/Tests/Component/Graph/GraphUnitTest.php index a68535c..9595f03 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Graph/GraphUnitTest.php +++ b/core/tests/Drupal/Tests/Component/Graph/GraphUnitTest.php @@ -2,20 +2,20 @@ /** * @file - * Definition of Drupal\system\Tests\Graph\GraphUnitTest. + * Definition of Drupal\Tests\Component\Graph\GraphUnitTest. */ -namespace Drupal\system\Tests\Graph; +namespace Drupal\Tests\Component\Graph; use Drupal\Component\Graph\Graph; -use Drupal\simpletest\UnitTestBase; +use Drupal\Tests\UnitTestCase; /** * Unit tests for the graph handling features. * * @see Drupal\Component\Graph\Graph */ -class GraphUnitTest extends UnitTestBase { +class GraphUnitTest extends UnitTestCase { public static function getInfo() { return array( 'name' => 'Directed acyclic graph manipulation', @@ -119,7 +119,7 @@ function assertPaths($graph, $expected_paths) { // Build an array with keys = $paths and values = TRUE. $expected = array_fill_keys($paths, TRUE); $result = isset($graph[$vertex]['paths']) ? $graph[$vertex]['paths'] : array(); - $this->assertEqual($expected, $result, format_string('Expected paths for vertex @vertex: @expected-paths, got @paths', array('@vertex' => $vertex, '@expected-paths' => $this->displayArray($expected, TRUE), '@paths' => $this->displayArray($result, TRUE)))); + $this->assertEquals($expected, $result, sprintf('Expected paths for vertex %s: %s, got %s', $vertex, $this->displayArray($expected, TRUE), $this->displayArray($result, TRUE))); } } @@ -137,7 +137,7 @@ function assertReversePaths($graph, $expected_reverse_paths) { // Build an array with keys = $paths and values = TRUE. $expected = array_fill_keys($paths, TRUE); $result = isset($graph[$vertex]['reverse_paths']) ? $graph[$vertex]['reverse_paths'] : array(); - $this->assertEqual($expected, $result, format_string('Expected reverse paths for vertex @vertex: @expected-paths, got @paths', array('@vertex' => $vertex, '@expected-paths' => $this->displayArray($expected, TRUE), '@paths' => $this->displayArray($result, TRUE)))); + $this->assertEquals($expected, $result, sprintf('Expected reverse paths for vertex %s: %s, got %s', $vertex, $this->displayArray($expected, TRUE), $this->displayArray($result, TRUE))); } } @@ -157,9 +157,9 @@ function assertComponents($graph, $expected_components) { $result_components[] = $graph[$vertex]['component']; unset($unassigned_vertices[$vertex]); } - $this->assertEqual(1, count(array_unique($result_components)), format_string('Expected one unique component for vertices @vertices, got @components', array('@vertices' => $this->displayArray($component), '@components' => $this->displayArray($result_components)))); + $this->assertEquals(1, count(array_unique($result_components)), sprintf('Expected one unique component for vertices %s, got %s', $this->displayArray($component), $this->displayArray($result_components))); } - $this->assertEqual(array(), $unassigned_vertices, format_string('Vertices not assigned to a component: @vertices', array('@vertices' => $this->displayArray($unassigned_vertices, TRUE)))); + $this->assertEquals(array(), $unassigned_vertices, sprintf('Vertices not assigned to a component: %s', $this->displayArray($unassigned_vertices, TRUE))); } /** @@ -174,7 +174,7 @@ function assertWeights($graph, $expected_orders) { foreach ($expected_orders as $order) { $previous_vertex = array_shift($order); foreach ($order as $vertex) { - $this->assertTrue($graph[$previous_vertex]['weight'] < $graph[$vertex]['weight'], format_string('Weights of @previous-vertex and @vertex are correct relative to each other', array('@previous-vertex' => $previous_vertex, '@vertex' => $vertex))); + $this->assertTrue($graph[$previous_vertex]['weight'] < $graph[$vertex]['weight'], sprintf('Weights of %s and %s are correct relative to each other', $previous_vertex, $vertex)); } } }