Mercurial > hg > isophonics-drupal-site
comparison core/modules/simpletest/src/Tests/SimpleTestBrowserTest.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
author | Chris Cannam |
---|---|
date | Thu, 09 May 2019 15:33:08 +0100 |
parents | 129ea1e6d783 |
children |
comparison
equal
deleted
inserted
replaced
17:129ea1e6d783 | 18:af1871eacc83 |
---|---|
2 | 2 |
3 namespace Drupal\simpletest\Tests; | 3 namespace Drupal\simpletest\Tests; |
4 | 4 |
5 use Drupal\Core\Url; | 5 use Drupal\Core\Url; |
6 use Drupal\simpletest\WebTestBase; | 6 use Drupal\simpletest\WebTestBase; |
7 use Drupal\Tests\simpletest\Functional\ThroughUITest; | |
8 | 7 |
9 /** | 8 /** |
10 * Tests the Simpletest UI internal browser. | 9 * Tests the WebTestBase internal browser. |
11 * | 10 * |
12 * @group simpletest | 11 * @group simpletest |
12 * @group WebTestBase | |
13 */ | 13 */ |
14 class SimpleTestBrowserTest extends WebTestBase { | 14 class SimpleTestBrowserTest extends WebTestBase { |
15 | 15 |
16 /** | 16 /** |
17 * Modules to enable. | 17 * Modules to enable. |
56 $this->assertEqual(0, $this->container->get('current_user')->id(), 'Current user service updated.'); | 56 $this->assertEqual(0, $this->container->get('current_user')->id(), 'Current user service updated.'); |
57 | 57 |
58 // Test the maximum redirection option. | 58 // Test the maximum redirection option. |
59 $this->maximumRedirects = 1; | 59 $this->maximumRedirects = 1; |
60 $edit = [ | 60 $edit = [ |
61 'name' => $user->getUsername(), | 61 'name' => $user->getAccountName(), |
62 'pass' => $user->pass_raw, | 62 'pass' => $user->pass_raw, |
63 ]; | 63 ]; |
64 $this->drupalPostForm('user/login', $edit, t('Log in'), [ | 64 $this->drupalPostForm('user/login', $edit, t('Log in'), [ |
65 'query' => ['destination' => 'user/logout'], | 65 'query' => ['destination' => 'user/logout'], |
66 ]); | 66 ]); |
114 $this->assertResponse(403, 'Requesting http.php with a normal User-Agent fails.'); | 114 $this->assertResponse(403, 'Requesting http.php with a normal User-Agent fails.'); |
115 $this->drupalGet($https_path); | 115 $this->drupalGet($https_path); |
116 $this->assertResponse(403, 'Requesting https.php with a normal User-Agent fails.'); | 116 $this->assertResponse(403, 'Requesting https.php with a normal User-Agent fails.'); |
117 } | 117 } |
118 | 118 |
119 /** | |
120 * Tests that PHPUnit and KernelTestBase tests work through the UI. | |
121 */ | |
122 public function testTestingThroughUI() { | |
123 $this->drupalGet('admin/config/development/testing'); | |
124 $this->assertTrue(strpos($this->drupalSettings['simpleTest']['images'][0], 'core/misc/menu-collapsed.png') > 0, 'drupalSettings contains a link to core/misc/menu-collapsed.png.'); | |
125 // We can not test WebTestBase tests here since they require a valid .htkey | |
126 // to be created. However this scenario is covered by the testception of | |
127 // \Drupal\simpletest\Tests\SimpleTestTest. | |
128 | |
129 $tests = [ | |
130 // A KernelTestBase test. | |
131 'Drupal\KernelTests\KernelTestBaseTest', | |
132 // A PHPUnit unit test. | |
133 'Drupal\Tests\action\Unit\Menu\ActionLocalTasksTest', | |
134 // A PHPUnit functional test. | |
135 ThroughUITest::class, | |
136 ]; | |
137 | |
138 foreach ($tests as $test) { | |
139 $this->drupalGet('admin/config/development/testing'); | |
140 $edit = [ | |
141 "tests[$test]" => TRUE, | |
142 ]; | |
143 $this->drupalPostForm(NULL, $edit, t('Run tests')); | |
144 $this->assertText('0 fails, 0 exceptions'); | |
145 } | |
146 } | |
147 | |
148 } | 119 } |