You are here

public function ChecklistTest::testCheckSearch in Security Review 8

Tests Checklist's Check search functions.

Tests the search functions of Checklist: getCheck(). getCheckById().

File

tests/src/Kernel/ChecklistTest.php, line 110

Class

ChecklistTest
Contains test for Checklist.

Namespace

Drupal\Tests\security_review\Kernel

Code

public function testCheckSearch() {
  foreach ($this->checklist
    ->getChecks() as $check) {

    // getCheck().
    $found = $this->checklist
      ->getCheck($check
      ->getMachineNamespace(), $check
      ->getMachineTitle());
    $this
      ->assertEquals($check
      ->id(), $found
      ->id(), 'Found ' . $check
      ->getTitle() . '.');

    // getCheckById().
    $found = $this->checklist
      ->getCheckById($check
      ->id());
    $this
      ->assertEquals($check
      ->id(), $found
      ->id(), 'Found ' . $check
      ->getTitle() . '.');
  }
}