comparison core/modules/tracker/tests/src/Functional/TrackerTest.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
3 namespace Drupal\Tests\tracker\Functional; 3 namespace Drupal\Tests\tracker\Functional;
4 4
5 use Drupal\comment\CommentInterface; 5 use Drupal\comment\CommentInterface;
6 use Drupal\comment\Tests\CommentTestTrait; 6 use Drupal\comment\Tests\CommentTestTrait;
7 use Drupal\Core\Cache\Cache; 7 use Drupal\Core\Cache\Cache;
8 use Drupal\Core\Database\Database;
8 use Drupal\Core\EventSubscriber\MainContentViewSubscriber; 9 use Drupal\Core\EventSubscriber\MainContentViewSubscriber;
9 use Drupal\Core\Session\AccountInterface; 10 use Drupal\Core\Session\AccountInterface;
10 use Drupal\field\Entity\FieldStorageConfig; 11 use Drupal\field\Entity\FieldStorageConfig;
11 use Drupal\node\Entity\Node; 12 use Drupal\node\Entity\Node;
12 use Drupal\Tests\BrowserTestBase; 13 use Drupal\Tests\BrowserTestBase;
197 198
198 $this->assertLink($my_published->label()); 199 $this->assertLink($my_published->label());
199 $this->assertNoLink($unpublished->label()); 200 $this->assertNoLink($unpublished->label());
200 // Verify that title and tab title have been set correctly. 201 // Verify that title and tab title have been set correctly.
201 $this->assertText('Activity', 'The user activity tab has the name "Activity".'); 202 $this->assertText('Activity', 'The user activity tab has the name "Activity".');
202 $this->assertTitle(t('@name | @site', ['@name' => $this->user->getUsername(), '@site' => $this->config('system.site')->get('name')]), 'The user tracker page has the correct page title.'); 203 $this->assertTitle(t('@name | @site', ['@name' => $this->user->getAccountName(), '@site' => $this->config('system.site')->get('name')]), 'The user tracker page has the correct page title.');
203 204
204 // Verify that unpublished comments are removed from the tracker. 205 // Verify that unpublished comments are removed from the tracker.
205 $admin_user = $this->drupalCreateUser(['post comments', 'administer comments', 'access user profiles']); 206 $admin_user = $this->drupalCreateUser(['post comments', 'administer comments', 'access user profiles']);
206 $this->drupalLogin($admin_user); 207 $this->drupalLogin($admin_user);
207 $this->drupalPostForm('comment/1/edit', ['status' => CommentInterface::NOT_PUBLISHED], t('Save')); 208 $this->drupalPostForm('comment/1/edit', ['status' => CommentInterface::NOT_PUBLISHED], t('Save'));
371 372
372 // Start indexing backwards from node 4. 373 // Start indexing backwards from node 4.
373 \Drupal::state()->set('tracker.index_nid', 4); 374 \Drupal::state()->set('tracker.index_nid', 4);
374 375
375 // Clear the current tracker tables and rebuild them. 376 // Clear the current tracker tables and rebuild them.
376 db_delete('tracker_node') 377 $connection = Database::getConnection();
378 $connection->delete('tracker_node')
377 ->execute(); 379 ->execute();
378 db_delete('tracker_user') 380 $connection->delete('tracker_user')
379 ->execute(); 381 ->execute();
380 tracker_cron(); 382 tracker_cron();
381 383
382 $this->drupalLogin($this->user); 384 $this->drupalLogin($this->user);
383 385