1 comment_views_handler_argument_user_uid.test protected CommentViewsHandlerArgumentUserUidTest::setUp(array $modules = array())

Sets up a Backdrop site for running functional and integration tests.

Generates a random database prefix and installs Backdrop with the specified installation profile in BackdropWebTestCase::$profile into the prefixed database. Afterwards, installs any additional modules specified by the test.

After installation all caches are flushed and several configuration values are reset to the values of the parent site executing the test, since the default values may be incompatible with the environment in which tests are being executed.

Parameters

...: List of modules to enable for the duration of the test. This can be either a single array or a variable number of string arguments.

Return value

bool: TRUE if set up completes, FALSE if an error occurred.

Overrides ViewsSqlTest::setUp

See also

BackdropWebTestCase::prepareDatabasePrefix()

BackdropWebTestCase::changeDatabasePrefix()

BackdropWebTestCase::prepareEnvironment()

File

core/modules/comment/tests/comment_views_handler_argument_user_uid.test, line 56
Definition of CommentViewsHandlerArgumentUserUidTest.

Class

CommentViewsHandlerArgumentUserUidTest
Tests the argument_comment_user_uid handler.

Code

protected function setUp(array $modules = array()) {
  $modules[] = 'comment';
  parent::setUp($modules);

  // Create a post content type with comments enabled and grant permissions.
  $this->backdropCreateContentType(array(
    'type' => 'post',
    'name' => 'Post',
    'settings' => array(
      'comment_default' => COMMENT_NODE_OPEN,
    ),
    'is_new' => TRUE,
  ));
  user_role_grant_permissions(BACKDROP_AUTHENTICATED_ROLE, array(
    'access content',
    'access comments',
    'post comments',
    'skip comment approval',
  ));

  // Add two users, create a node with user1 as author and another node with
  // user2 as author. For the second node, add a comment from user1.
  $this->account = $this->backdropCreateUser();
  $account2 = $this->backdropCreateUser();
  $this->backdropLogin($this->account);
  $this->node_user_posted = $this->backdropCreateNode();
  $this->node_user_commented = $this->backdropCreateNode(array(
    'type' => 'post',
    'uid' => $account2->uid,
  ));
  $this->postComment($this->node_user_commented);
}