You are here

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

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

Tests Raven module functionality.

File

./raven.test, line 75
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_dsn'] = 'https://user@sentry.test/123456';
  $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');
  $memory_limit = mt_rand(8000000, 9999999);
  $this
    ->assertEqual($memory_limit, $this
    ->drupalGet('', [
    'query' => [
      'memory_limit' => $memory_limit,
    ],
  ]));
}