comparison core/modules/simpletest/tests/src/Functional/SimpletestUiTest.php @ 18:af1871eacc83

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:33:08 +0100
parents
children
comparison
equal deleted inserted replaced
17:129ea1e6d783 18:af1871eacc83
1 <?php
2
3 namespace Drupal\Tests\simpletest\Functional;
4
5 use Drupal\Core\Url;
6 use Drupal\KernelTests\KernelTestBaseTest;
7 use Drupal\Tests\action\Unit\Menu\ActionLocalTasksTest;
8 use Drupal\Tests\BrowserTestBase;
9
10 /**
11 * Test various aspects of testing through the UI form.
12 *
13 * @group #slow
14 * @group simpletest
15 */
16 class SimpletestUiTest extends BrowserTestBase {
17
18 /**
19 * {@inheritdoc}
20 */
21 public static $modules = ['simpletest'];
22
23 /**
24 * {@inheritdoc}
25 */
26 protected function setUp() {
27 parent::setUp();
28 $this->drupalLogin($this->createUser(['administer unit tests']));
29 }
30
31 /**
32 * Tests that unit, kernel, and functional tests work through the UI.
33 */
34 public function testTestingThroughUI() {
35 $url = Url::fromRoute('simpletest.test_form');
36 $assertion = $this->assertSession();
37
38 $this->drupalGet($url);
39 $settings = $this->getDrupalSettings();
40 $this->assertTrue(strpos($settings['simpleTest']['images'][0], 'core/misc/menu-collapsed.png') > 0, 'drupalSettings contains a link to core/misc/menu-collapsed.png.');
41
42 // We can not test WebTestBase tests here since they require a valid .htkey
43 // to be created. However this scenario is covered by the testception of
44 // \Drupal\simpletest\Tests\SimpleTestTest.
45 $tests = [
46 // A KernelTestBase test.
47 KernelTestBaseTest::class,
48 // A PHPUnit unit test.
49 ActionLocalTasksTest::class,
50 // A PHPUnit functional test.
51 ThroughUITest::class,
52 ];
53
54 foreach ($tests as $test) {
55 $edit = [
56 "tests[$test]" => TRUE,
57 ];
58 $this->drupalPostForm($url, $edit, t('Run tests'));
59 $assertion->pageTextContains('0 fails, 0 exceptions');
60 }
61 }
62
63 }