You are here

class WatchdogReportCase in Site Audit 8.2

Class WatchdogReportCase.

@group commands

Hierarchy

Expanded class hierarchy of WatchdogReportCase

File

tests/watchdogReportTest.php, line 16
Contains /site_audit/tests/WatchdogReportCase.

Namespace

Unish
View source
class WatchdogReportCase extends SiteAuditTestAbstract {

  /**
   * Sets up the environment for this test.
   */
  public function setUp() {
    $this
      ->setUpSiteAuditTestEnvironment();
  }

  /**
   * Block the user with uid 1. Check should Fail.
   */
  public function test404Warn() {
    $this
      ->drush('en', array(
      'dblog',
    ), $this->options);
    $eval1 = "\\Drupal::logger('page not found')->warning('drush tests');";
    for ($i = 0; $i < 100; $i++) {
      $this
        ->drush('php-eval', array(
        $eval1,
      ), $this->options);
    }
    $this
      ->drush('audit-watchdog', array(), $this->options + array(
      'detail' => NULL,
      'json' => NULL,
    ));
    $output = $this
      ->getOutput();
    $output = json_decode($output);
    $this
      ->assertEquals(\SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN, $output->checks->SiteAuditCheckWatchdog404->score);
  }

  /**
   * Create more than 10% php errors. Should Warn.
   */
  public function testPhpWarn() {
    $this
      ->drush('en', array(
      'dblog',
    ), $this->options);
    $eval1 = "\\Drupal::logger('php')->warning('drush tests');";
    for ($i = 0; $i < 100; $i++) {
      $this
        ->drush('php-eval', array(
        $eval1,
      ), $this->options);
    }
    $this
      ->drush('audit-watchdog', array(), $this->options + array(
      'detail' => NULL,
      'json' => NULL,
    ));
    $output = $this
      ->getOutput();
    $output = json_decode($output);
    $this
      ->assertEquals(\SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_WARN, $output->checks->SiteAuditCheckWatchdogPhp->score);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SiteAuditTestAbstract::setUpSiteAuditTestEnvironment public function Sets up environment for running site_audit tests.
WatchdogReportCase::setUp public function Sets up the environment for this test.
WatchdogReportCase::test404Warn public function Block the user with uid 1. Check should Fail.
WatchdogReportCase::testPhpWarn public function Create more than 10% php errors. Should Warn.