You are here

public function MissingCheckedRequirementsTest::testCheckRequirements in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/simpletest/src/Tests/MissingCheckedRequirementsTest.php \Drupal\simpletest\Tests\MissingCheckedRequirementsTest::testCheckRequirements()

Ensures test will not run when requirements are missing.

File

core/modules/simpletest/src/Tests/MissingCheckedRequirementsTest.php, line 47
Contains \Drupal\simpletest\Tests\MissingCheckedRequirementsTest.

Class

MissingCheckedRequirementsTest
Tests a test case with missing requirements.

Namespace

Drupal\simpletest\Tests

Code

public function testCheckRequirements() {

  // If this is the main request, run the web test script and then assert
  // that the child tests did not run.
  if (!$this
    ->isInChildSite()) {

    // Run this test from web interface.
    $edit['tests[Drupal\\simpletest\\Tests\\MissingCheckedRequirementsTest]'] = TRUE;
    $this
      ->drupalPostForm('admin/config/development/testing', $edit, t('Run tests'));
    $this
      ->assertRaw('Test is not allowed to run.', 'Test check for requirements came up.');
    $this
      ->assertNoText('Test ran when it failed requirements check.', 'Test requirements stopped test from running.');
  }
  else {
    $this
      ->fail('Test ran when it failed requirements check.');
  }
}