You are here

public function AdminViewsAccessHandlerTestCase::testAjaxAccess in Administration Views 7

Tests access handler via views/ajax.

File

tests/admin_views.test, line 343
Tests for the Administration Views module.

Class

AdminViewsAccessHandlerTestCase
Tests default views.

Code

public function testAjaxAccess() {
  $params = array(
    'view_name' => 'admin_views_user',
    'view_display_id' => 'system_1',
  );
  $response_data = $this
    ->drupalGetAJAX('views/ajax', array(
    'query' => $params,
  ));
  $this
    ->assertResponse(200);

  // Check no views settings are returned.
  $this
    ->assertTrue(empty($response_data[0]['settings']['views']));

  // The next item in the AJAX data will be the insert command containing the
  // rendered view.
  $this
    ->assertTrue(empty($response_data[1]));

  // Test the access again with the default display.
  $params['views_display_id'] = 'default';
  $response_data = $this
    ->drupalGetAJAX('views/ajax', array(
    'query' => $params,
  ));
  $this
    ->assertResponse(200);

  // Check no views settings are returned.
  $this
    ->assertTrue(empty($response_data[0]['settings']['views']));

  // The next item in the AJAX data will be the insert command containing the
  // rendered view.
  $this
    ->assertTrue(empty($response_data[1]));
}