diff --git a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php index 37638836f2..24c84d6c74 100644 --- a/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php +++ b/core/modules/taxonomy/src/Plugin/views/filter/TaxonomyIndexTid.php @@ -69,7 +69,7 @@ public function __construct(array $configuration, $plugin_id, $plugin_definition $this->vocabularyStorage = $vocabulary_storage; $this->termStorage = $term_storage; if (!$entity_repository) { - @trigger_error('Calling TaxonomyIndexTid::__construct() without the $entity_repository argument is deprecated in drupal:9.1.0 and the $entity_repository argument will be required in drupal:10.0.0. See https://www.drupal.org/node/3162414', E_USER_DEPRECATED); + @trigger_error('Calling ' . __NAMESPACE__ . '\TaxonomyIndexTid::__construct() without the $entity_repository argument is deprecated in drupal:9.1.0 and the $entity_repository argument will be required in drupal:10.0.0. See https://www.drupal.org/node/3162414', E_USER_DEPRECATED); $entity_repository = \Drupal::service('entity.repository'); } $this->entityRepository = $entity_repository; @@ -187,7 +187,7 @@ protected function valueForm(&$form, FormStateInterface $form_state) { ]) : $this->t('Select terms'), ]; - if ($this->options['type'] == 'textfield') { + if ($this->options['type'] === 'textfield') { $terms = $this->value ? $this->termStorage->loadMultiple($this->value) : []; $form['value'] += [ '#type' => 'textfield', diff --git a/core/modules/taxonomy/tests/src/Functional/Update/TaxonomyTermIdFilterUpdateTest.php b/core/modules/taxonomy/tests/src/Functional/Update/TaxonomyTermIdFilterUpdateTest.php index 68428e2f10..d08a3d291d 100644 --- a/core/modules/taxonomy/tests/src/Functional/Update/TaxonomyTermIdFilterUpdateTest.php +++ b/core/modules/taxonomy/tests/src/Functional/Update/TaxonomyTermIdFilterUpdateTest.php @@ -22,7 +22,7 @@ class TaxonomyTermIdFilterUpdateTest extends UpdatePathTestBase { */ protected function setDatabaseDumpFiles(): void { $this->databaseDumpFiles = [ - __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-8.8.0.bare.standard.php.gz', + dirname(__DIR__, 5) . '/system/tests/fixtures/update/drupal-8.8.0.bare.standard.php.gz', ]; } @@ -31,7 +31,7 @@ protected function setDatabaseDumpFiles(): void { */ public function testPostUpdateTaxonomyIndexFilterMultipleVocabularies(): void { // Prepare the test view with the old schema. - $view_as_array = Yaml::decode(file_get_contents(__DIR__ . '/../../../modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml')); + $view_as_array = Yaml::decode(file_get_contents(dirname(__DIR__, 3) . '/modules/taxonomy_test_views/test_views/views.view.test_filter_taxonomy_index_tid.yml')); $view_as_array['display']['default']['display_options']['filters']['tid']['vid'] = 'tags'; unset($view_as_array['display']['default']['display_options']['filters']['tid']['vids']); $db = \Drupal::database(); diff --git a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyIndexTidUiTest.php b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyIndexTidUiTest.php index 861be7583a..59fa924cb1 100644 --- a/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyIndexTidUiTest.php +++ b/core/modules/taxonomy/tests/src/Functional/Views/TaxonomyIndexTidUiTest.php @@ -123,8 +123,6 @@ protected function createVocabularyAndTerms($vocab_id) { public function testFilterUI() { $this->drupalGet('admin/structure/views/nojs/handler/test_filter_taxonomy_index_tid/default/filter/tid'); - $this->assertFieldByXpath('//select[@id="edit-options-value"]', NULL); - $result = $this->xpath('//select[@id="edit-options-value"]/option'); // Ensure that the expected hierarchy is available in the UI. @@ -167,7 +165,7 @@ public function testFilterUI() { } /** - * Test filter UI with multiple vocabularies + * Tests filter UI with multiple vocabularies */ public function testFilterUIWithMultipleVocabularies() { $terms2 = $this->createVocabularyAndTerms('tags2'); @@ -206,36 +204,36 @@ public function testFilterUIWithMultipleVocabularies() { $this->drupalPostForm(NULL, [], 'Save'); $this->drupalGet('test-filter-taxonomy-index-tid', ['query' => ['tid' => '']]); $xpath = $this->xpath('//div[@class="view-content"]//a'); - $this->assertIdentical(3, count($xpath)); + $this->assertCount(3, $xpath); $this->drupalGet('test-filter-taxonomy-index-tid', ['query' => ['tid' => "t1 ({$this->terms[0][0]->id()})"]]); $xpath = $this->xpath('//div[@class="view-content"]//a'); - $this->assertIdentical(2, count($xpath)); + $this->assertCount(2, $xpath); $xpath = $this->xpath('//div[@class="view-content"]//a[@href=:href]', [ ':href' => $node0->toUrl()->toString(), ]); - $this->assertIdentical(1, count($xpath)); + $this->assertCount(1, $xpath); $xpath = $this->xpath('//div[@class="view-content"]//a[@href=:href]', [ ':href' => $node2->toUrl()->toString(), ]); - $this->assertIdentical(1, count($xpath)); + $this->assertCount(1, $xpath); $this->drupalGet('test-filter-taxonomy-index-tid', ['query' => ['tid' => "t2 ({$terms2[0][0]->id()})"]]); $xpath = $this->xpath('//div[@class="view-content"]//a'); - $this->assertIdentical(2, count($xpath)); + $this->assertCount(2, $xpath); $xpath = $this->xpath('//div[@class="view-content"]//a[@href=:href]', [ ':href' => $node1->toUrl()->toString(), ]); - $this->assertIdentical(1, count($xpath)); + $this->assertCount(1, $xpath); $xpath = $this->xpath('//div[@class="view-content"]//a[@href=:href]', [ ':href' => $node2->toUrl()->toString(), ]); - $this->assertIdentical(1, count($xpath)); + $this->assertCount(1, $xpath); $this->drupalGet('test-filter-taxonomy-index-tid', ['query' => ['tid' => "t1 ({$this->terms[0][0]->id()}), t2 ({$terms2[0][0]->id()})"]]); $xpath = $this->xpath('//div[@class="view-content"]//a'); - $this->assertIdentical(1, count($xpath)); + $this->assertCount(1, $xpath); $xpath = $this->xpath('//div[@class="view-content"]//a[@href=:href]', [ ':href' => $node2->toUrl()->toString(), ]); - $this->assertIdentical(1, count($xpath)); + $this->assertCount(1, $xpath); } /**