Security update for Core, with self-updated composer
[yaffs-website] / web / core / modules / tracker / src / Tests / Views / TrackerTestBase.php
1 <?php
2
3 namespace Drupal\tracker\Tests\Views;
4
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);
6
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;
12
13 /**
14  * Base class for all tracker tests.
15  *
16  * @deprecated Scheduled for removal in Drupal 9.0.0.
17  *   Use \Drupal\Tests\tracker\Functional\Views\TrackerTestBase instead.
18  */
19 abstract class TrackerTestBase extends ViewTestBase {
20
21   use CommentTestTrait;
22
23   /**
24    * Modules to enable.
25    *
26    * @var array
27    */
28   public static $modules = ['comment', 'tracker', 'tracker_test_views'];
29
30   /**
31    * The node used for testing.
32    *
33    * @var \Drupal\node\NodeInterface
34    */
35   protected $node;
36
37   /**
38    * The comment used for testing.
39    *
40    * @var \Drupal\comment\CommentInterface
41    */
42   protected $comment;
43
44   protected function setUp() {
45     parent::setUp();
46
47     ViewTestData::createTestViews(get_class($this), ['tracker_test_views']);
48
49     $this->drupalCreateContentType(['type' => 'page', 'name' => 'Basic page']);
50     // Add a comment field.
51     $this->addDefaultCommentField('node', 'page');
52
53     $permissions = ['access comments', 'create page content', 'post comments', 'skip comment approval'];
54     $account = $this->drupalCreateUser($permissions);
55
56     $this->drupalLogin($account);
57
58     $this->node = $this->drupalCreateNode([
59       'title' => $this->randomMachineName(8),
60       'uid' => $account->id(),
61       'status' => 1,
62     ]);
63
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),
70     ]);
71
72   }
73
74 }