You are here

public function RavenTestCase::testRaven in Raven: Sentry Integration 7.3

Same name and namespace in other branches
  1. 7.4 raven.test \RavenTestCase::testRaven()
  2. 7 raven.test \RavenTestCase::testRaven()
  3. 7.2 raven.test \RavenTestCase::testRaven()

Tests Raven module functionality.

File

./raven.test, line 77
Tests for Raven.module.

Class

RavenTestCase
Tests logging messages to the database.

Code

public function testRaven() {
  $this
    ->drupalLogin($this->adminUser);
  $this
    ->drupalGet('admin/reports/status');
  $this
    ->drupalGet('admin/config/development/logging');
  $edit['raven_enabled'] = TRUE;
  $edit['raven_watchdog_levels[4]'] = 4;
  $edit['raven_watchdog_levels[6]'] = 6;
  $edit['raven_fatal_error_handler'] = TRUE;
  $this
    ->drupalPost(NULL, $edit, 'Save configuration');
  $this
    ->drupalLogout();
  $this
    ->drupalLogin($this->anyUser);
  $this
    ->assertNoText('Sentry PHP library cannot be loaded. Check status report for more details.');
  $this
    ->assertIdentical($this
    ->drupalGetHeader('X-Logged'), 'Logged');
  $this
    ->assertFalse($this
    ->drupalGetHeader('X-Not-Logged'));
  $this
    ->assertIdentical(realpath($this
    ->drupalGetHeader('X-Watchdog-File')), realpath(drupal_get_filename('module', 'raven_test')));
  $this
    ->assertIdentical(realpath($this
    ->drupalGetHeader('X-Watchdog-Exception-File')), realpath(drupal_get_filename('module', 'raven_test')));
  $this
    ->assertIdentical($this
    ->drupalGetHeader('X-Watchdog-Exception-Function'), 'raven_test_throw_exception');
  $cookies = drupal_json_decode($this
    ->drupalGetHeader('X-Watchdog-Cookies'));
  $this
    ->assertIdentical($cookies['ravenCookie'], '********');
  $memory_limit = mt_rand(8000000, 9999999);
  $this
    ->assertEqual($memory_limit, $this
    ->drupalGet('', array(
    'query' => array(
      'memory_limit' => $memory_limit,
    ),
  )));
}