diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php index efc49c8..9a9375a 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyTest.php @@ -98,7 +98,6 @@ function testTaxonomyAdminChangingWeights() { // Load the vocabularies from the database. $this->container->get('plugin.manager.entity')->getStorageController('taxonomy_vocabulary')->resetCache(); $new_vocabularies = taxonomy_vocabulary_load_multiple(); - taxonomy_vocabulary_sort($new_vocabularies); // Check that the weights are saved in the database correctly. foreach ($vocabularies as $key => $vocabulary) { diff --git a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php index 909cbcb..c7c1454 100644 --- a/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php +++ b/core/modules/taxonomy/lib/Drupal/taxonomy/Tests/VocabularyUnitTest.php @@ -120,20 +120,19 @@ function testTaxonomyVocabularyLoadMultiple() { $names = taxonomy_vocabulary_get_names(); $this->assertEqual($names[$vocabulary1->id()], $vocabulary1->id(), 'Vocabulary 1 name found.'); - // Fetch all of the vocabularies using taxonomy_vocabulary_load_multiple(). + // Fetch all vocabularies skipping a cache. // Confirm that the vocabularies are ordered by weight. - $vocabularies = taxonomy_vocabulary_load_multiple(); - taxonomy_vocabulary_sort($vocabularies); - $this->assertEqual(array_shift($vocabularies)->id(), $vocabulary1->id(), 'Vocabulary was found in the vocabularies array.'); - $this->assertEqual(array_shift($vocabularies)->id(), $vocabulary2->id(), 'Vocabulary was found in the vocabularies array.'); - $this->assertEqual(array_shift($vocabularies)->id(), $vocabulary3->id(), 'Vocabulary was found in the vocabularies array.'); + $vocabularies = $this->container->get('plugin.manager.entity')->getStorageController('taxonomy_vocabulary')->load(NULL, TRUE); + $loaded_order = array_keys($vocabularies); + $expected_order = array($vocabulary1->id(), $vocabulary2->id(), $vocabulary3->id()); + $this->assertIdentical($loaded_order, $expected_order); // Fetch the vocabularies with taxonomy_vocabulary_load_multiple(), specifying IDs. // Ensure they are returned in the same order as the original array. $vocabularies = taxonomy_vocabulary_load_multiple(array($vocabulary3->id(), $vocabulary2->id(), $vocabulary1->id())); - $this->assertEqual(array_shift($vocabularies)->id(), $vocabulary3->id(), 'Vocabulary loaded successfully by ID.'); - $this->assertEqual(array_shift($vocabularies)->id(), $vocabulary2->id(), 'Vocabulary loaded successfully by ID.'); - $this->assertEqual(array_shift($vocabularies)->id(), $vocabulary1->id(), 'Vocabulary loaded successfully by ID.'); + $loaded_order = array_keys($vocabularies); + $expected_order = array($vocabulary3->id(), $vocabulary2->id(), $vocabulary1->id()); + $this->assertIdentical($loaded_order, $expected_order); // Test loading vocabularies by their properties. $controller = $this->container->get('plugin.manager.entity')->getStorageController('taxonomy_vocabulary'); diff --git a/core/modules/taxonomy/taxonomy.module b/core/modules/taxonomy/taxonomy.module index 6ed67a1..901067a 100644 --- a/core/modules/taxonomy/taxonomy.module +++ b/core/modules/taxonomy/taxonomy.module @@ -817,18 +817,6 @@ function taxonomy_vocabulary_load_multiple(array $vids = NULL) { } /** - * Sorts vocabularies by its weight and label. - * - * @param array $vocabularies - * An array of \Drupal\taxonomy\Plugin\Core\Entity\Vocabulary objects. - */ -function taxonomy_vocabulary_sort(array &$vocabularies = array()) { - // @todo Remove error suppressing when http://drupal.org/node/1799600 is - // fixed. - @uasort($vocabularies, 'Drupal\Core\Config\Entity\ConfigEntityBase::sort'); -} - -/** * Return the taxonomy vocabulary entity matching a vocabulary ID. * * @param int $vid