3 namespace Drupal\security_review\Tests;
5 use Drupal\simpletest\WebTestBase;
8 * Contains tests for Check that don't suffice with KernelTestBase.
10 * @group security_review
12 class CheckWebTest extends WebTestBase {
19 public static $modules = ['security_review'];
22 * The security checks defined by Security Review.
24 * @var \Drupal\security_review\Check[]
31 * @var \Drupal\user\Entity\User
36 * Sets up the testing environment, logs the user in, populates $check.
38 protected function setUp() {
42 $this->user = $this->drupalCreateUser(
44 'run security checks',
45 'access security review list',
46 'access administration pages',
47 'administer site configuration',
50 $this->drupalLogin($this->user);
53 $this->checks = security_review_security_review_checks();
57 * Tests Check::skip().
59 * Checks whether skip() marks the check as skipped, and checks the
62 public function testSkipCheck() {
63 foreach ($this->checks as $check) {
66 $is_skipped = $check->isSkipped();
67 $skipped_by = $check->skippedBy();
69 $this->assertTrue($is_skipped, $check->getTitle() . ' skipped.');
70 $this->assertEqual($this->user->id(), $skipped_by->id(), 'Skipped by ' . $skipped_by->label());