comparison core/modules/taxonomy/tests/src/Functional/TaxonomyQueryAlterTest.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents 129ea1e6d783
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
1 <?php 1 <?php
2 2
3 namespace Drupal\Tests\taxonomy\Functional; 3 namespace Drupal\Tests\taxonomy\Functional;
4 4
5 use Drupal\Core\Database\Database;
5 use Drupal\Tests\BrowserTestBase; 6 use Drupal\Tests\BrowserTestBase;
6 7
7 /** 8 /**
8 * Tests that appropriate query tags are added. 9 * Tests that appropriate query tags are added.
9 * 10 *
56 $loaded_terms = $term_storage->loadChildren($terms[1]->id()); 57 $loaded_terms = $term_storage->loadChildren($terms[1]->id());
57 $this->assertEqual(count($loaded_terms), 1, 'All child terms were loaded'); 58 $this->assertEqual(count($loaded_terms), 1, 'All child terms were loaded');
58 $this->assertQueryTagTestResult(3, 1, 'TermStorage::loadChildren()'); 59 $this->assertQueryTagTestResult(3, 1, 'TermStorage::loadChildren()');
59 60
60 $this->setupQueryTagTestHooks(); 61 $this->setupQueryTagTestHooks();
61 $query = db_select('taxonomy_term_data', 't'); 62 $connection = Database::getConnection();
63 $query = $connection->select('taxonomy_term_data', 't');
62 $query->addField('t', 'tid'); 64 $query->addField('t', 'tid');
63 $query->addTag('taxonomy_term_access'); 65 $query->addTag('taxonomy_term_access');
64 $tids = $query->execute()->fetchCol(); 66 $tids = $query->execute()->fetchCol();
65 $this->assertEqual(count($tids), count($terms), 'All term IDs were retrieved'); 67 $this->assertEqual(count($tids), count($terms), 'All term IDs were retrieved');
66 $this->assertQueryTagTestResult(1, 1, 'custom db_select() with taxonomy_term_access tag (preferred)'); 68 $this->assertQueryTagTestResult(1, 1, 'custom db_select() with taxonomy_term_access tag (preferred)');
67 69
68 $this->setupQueryTagTestHooks(); 70 $this->setupQueryTagTestHooks();
69 $query = db_select('taxonomy_term_data', 't'); 71 $query = $connection->select('taxonomy_term_data', 't');
70 $query->addField('t', 'tid'); 72 $query->addField('t', 'tid');
71 $query->addTag('term_access'); 73 $query->addTag('term_access');
72 $tids = $query->execute()->fetchCol(); 74 $tids = $query->execute()->fetchCol();
73 $this->assertEqual(count($tids), count($terms), 'All term IDs were retrieved'); 75 $this->assertEqual(count($tids), count($terms), 'All term IDs were retrieved');
74 $this->assertQueryTagTestResult(1, 1, 'custom db_select() with term_access tag (deprecated)'); 76 $this->assertQueryTagTestResult(1, 1, 'custom db_select() with term_access tag (deprecated)');