MissingCheckedRequirementsTest.php in Zircon Profile 8.0
File
core/modules/simpletest/src/Tests/MissingCheckedRequirementsTest.php
View source
<?php
namespace Drupal\simpletest\Tests;
use Drupal\simpletest\WebTestBase;
class MissingCheckedRequirementsTest extends WebTestBase {
public static $modules = array(
'simpletest',
);
protected function setUp() {
parent::setUp();
$admin_user = $this
->drupalCreateUser(array(
'administer unit tests',
));
$this
->drupalLogin($admin_user);
}
protected function checkRequirements() {
if ($this
->isInChildSite()) {
return array(
'Test is not allowed to run.',
);
}
return parent::checkRequirements();
}
public function testCheckRequirements() {
if (!$this
->isInChildSite()) {
$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.');
}
}
}