You are here

class SecurityReportCase in Site Audit 8.2

Class SecurityReportCase.

@group commands

Hierarchy

Expanded class hierarchy of SecurityReportCase

File

tests/securityReportTest.php, line 16
Contains /site_audit/tests/SecurityReportCase.

Namespace

Unish
View source
class SecurityReportCase extends SiteAuditTestAbstract {

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

  /**
   * Check should pass on a default installation.
   */
  public function testMenuRouterPass() {
    $this
      ->drush('audit-security', array(), $this->options + array(
      'detail' => NULL,
      'json' => NULL,
    ));
    $output = $this
      ->getOutput();
    $output = json_decode($output);
    $this
      ->assertEquals(\SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_PASS, $output->checks->SiteAuditCheckSecurityMenuRouter->score);
  }

  /**
   * Enable a module with malicious menu router entry. Check should Fail.
   */
  public function testMenuRouterFail() {
    $dir = dirname(__DIR__) . '/tests/menu_router_test';
    \symlink($dir, $this->options['root'] . '/modules/menu_router_test');
    $this
      ->drush('pm-enable', array(
      'menu_router_test',
    ), $this->options);
    $this
      ->drush('audit-security', array(), $this->options + array(
      'detail' => NULL,
      'json' => NULL,
    ));
    $output = $this
      ->getOutput();
    $output = json_decode($output);
    $this
      ->assertEquals(\SiteAuditCheckAbstract::AUDIT_CHECK_SCORE_FAIL, $output->checks->SiteAuditCheckSecurityMenuRouter->score);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SecurityReportCase::setUp public function Sets up the environment for this test.
SecurityReportCase::testMenuRouterFail public function Enable a module with malicious menu router entry. Check should Fail.
SecurityReportCase::testMenuRouterPass public function Check should pass on a default installation.
SiteAuditTestAbstract::setUpSiteAuditTestEnvironment public function Sets up environment for running site_audit tests.