3 namespace Drupal\tracker\Tests\Views;
5 @trigger_error(__NAMESPACE__ . '\TrackerTestBase is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\tracker\Functional\Views\TrackerTestBase', E_USER_DEPRECATED);
7 use Drupal\comment\Tests\CommentTestTrait;
8 use Drupal\Core\Language\LanguageInterface;
9 use Drupal\views\Tests\ViewTestBase;
10 use Drupal\views\Tests\ViewTestData;
11 use Drupal\comment\Entity\Comment;
14 * Base class for all tracker tests.
16 * @deprecated Scheduled for removal in Drupal 9.0.0.
17 * Use \Drupal\Tests\tracker\Functional\Views\TrackerTestBase instead.
19 abstract class TrackerTestBase extends ViewTestBase {
28 public static $modules = ['comment', 'tracker', 'tracker_test_views'];
31 * The node used for testing.
33 * @var \Drupal\node\NodeInterface
38 * The comment used for testing.
40 * @var \Drupal\comment\CommentInterface
44 protected function setUp() {
47 ViewTestData::createTestViews(get_class($this), ['tracker_test_views']);
49 $this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
50 // Add a comment field.
51 $this->addDefaultCommentField('node', 'page');
53 $permissions = ['access comments', 'create page content', 'post comments', 'skip comment approval'];
54 $account = $this->drupalCreateUser($permissions);
56 $this->drupalLogin($account);
58 $this->node = $this->drupalCreateNode([
59 'title' => $this->randomMachineName(8),
60 'uid' => $account->id(),
64 $this->comment = Comment::create([
65 'entity_id' => $this->node->id(),
66 'entity_type' => 'node',
67 'field_name' => 'comment',
68 'subject' => $this->randomMachineName(),
69 'comment_body[' . LanguageInterface::LANGCODE_NOT_SPECIFIED . '][0][value]' => $this->randomMachineName(20),