SimpletestUiTest.php in Drupal 8
File
core/modules/simpletest/tests/src/Functional/SimpletestUiTest.php
View source
<?php
namespace Drupal\Tests\simpletest\Functional;
use Drupal\Core\Url;
use Drupal\KernelTests\KernelTestBaseTest;
use Drupal\Tests\action\Unit\Menu\ActionLocalTasksTest;
use Drupal\Tests\BrowserTestBase;
class SimpletestUiTest extends BrowserTestBase {
public static $modules = [
'simpletest',
];
protected function setUp() {
parent::setUp();
$this
->drupalLogin($this
->createUser([
'administer unit tests',
]));
}
public function testTestingThroughUI() {
$url = Url::fromRoute('simpletest.test_form');
$assertion = $this
->assertSession();
$this
->drupalGet($url);
$settings = $this
->getDrupalSettings();
$this
->assertTrue(strpos($settings['simpleTest']['images'][0], 'core/misc/menu-collapsed.png') > 0, 'drupalSettings contains a link to core/misc/menu-collapsed.png.');
$tests = [
KernelTestBaseTest::class,
ActionLocalTasksTest::class,
ThroughUITest::class,
];
foreach ($tests as $test) {
$edit = [
"tests[{$test}]" => TRUE,
];
$this
->drupalPostForm($url, $edit, t('Run tests'));
$assertion
->pageTextContains('0 fails, 0 exceptions');
}
}
}