3 namespace Drupal\Tests\draggableviews\Functional;
5 use Drupal\Tests\BrowserTestBase;
8 * Tests sortability of Draggableviewws.
10 * @group draggableviews
12 class DraggableviewsTest extends BrowserTestBase {
18 public static $modules = [
22 'draggableviews_demo',
26 * The installation profile to use with this test.
30 protected $profile = 'minimal';
35 public function setUp() {
39 $this->adminUser = $this->drupalCreateUser([
40 'access administration pages',
41 'view the administration theme',
42 'administer permissions',
44 'administer content types',
45 'access draggableviews',
47 $this->authUser = $this->drupalCreateUser([], 'authuser');
49 // Gather the test data.
50 $dataContent = $this->providerTestDataContent();
53 foreach ($dataContent as $datumContent) {
54 $node = $this->drupalCreateNode([
55 'type' => 'draggableviews_demo',
56 'title' => $datumContent[0],
63 * Data provider for setUp.
66 * Nested array of testing data, Arranged like this:
70 protected function providerTestDataContent() {
73 'Draggable Content 1',
74 'Draggable Content Body 1',
77 'Draggable Content 2',
78 'Draggable Content Body 2',
81 'Draggable Content 3',
82 'Draggable Content Body 3',
85 'Draggable Content 4',
86 'Draggable Content Body 4',
89 'Draggable Content 5',
90 'Draggable Content Body 5',
98 public function testDraggableviewsContent() {
99 $assert_session = $this->assertSession();
101 $this->drupalGet('draggableviews-demo');
102 $this->assertSession()->statusCodeEquals(200);
103 // Verify that anonymous useres cannot access the order page.
104 $this->drupalGet('draggableviews-demo/order');
105 $this->assertSession()->statusCodeEquals(403);
107 // Verify that authorized user has access to display page.
108 $this->drupalLogin($this->adminUser);
109 $this->drupalGet('draggableviews-demo');
110 $this->assertSession()->statusCodeEquals(200);
112 // Verify that the page contains generated content.
113 $assert_session->pageTextContains(t('Draggable Content 4'));
115 // Verify that authorized user has access to order page.
116 $this->drupalGet('draggableviews-demo/order');
117 $this->assertSession()->statusCodeEquals(200);
119 // Verify that the page contains generated content.
120 $assert_session->pageTextContains(t('Draggable Content 5'));