Exemplo n.º 1
0
 /**
  * Tests whether checks returned by getEnabledChecks() are all enabled.
  */
 public function testEnabledChecks()
 {
     foreach (Checklist::getEnabledChecks() as $check) {
         $this->assertFalse($check->isSkipped(), $check->getTitle() . ' is enabled.');
         // Disable check.
         $check->skip();
     }
     Checklist::clearCache();
     $this->assertEqual(count(Checklist::getEnabledChecks()), 0, 'Disabled all checks.');
 }
Exemplo n.º 2
0
 /**
  * Runs enabled checks and stores their results.
  */
 public static function runChecklist()
 {
     if (Drupal::currentUser()->hasPermission('run security checks')) {
         $checks = Checklist::getEnabledChecks();
         $results = Checklist::runChecks($checks);
         Checklist::storeResults($results);
         SecurityReview::setLastRun(time());
     } else {
         throw new AccessException();
     }
 }