comparison core/tests/Drupal/FunctionalTests/BrowserTestBaseTest.php @ 14:1fec387a4317

Update Drupal core to 8.5.2 via Composer
author Chris Cannam
date Mon, 23 Apr 2018 09:46:53 +0100
parents 7a779792577d
children c2387f117808
comparison
equal deleted inserted replaced
13:5fb285c0d0e3 14:1fec387a4317
186 } 186 }
187 187
188 /** 188 /**
189 * Tests legacy text asserts. 189 * Tests legacy text asserts.
190 */ 190 */
191 public function testLegacyTextAsserts() { 191 public function testTextAsserts() {
192 $this->drupalGet('test-encoded'); 192 $this->drupalGet('test-encoded');
193 $dangerous = 'Bad html <script>alert(123);</script>'; 193 $dangerous = 'Bad html <script>alert(123);</script>';
194 $sanitized = Html::escape($dangerous); 194 $sanitized = Html::escape($dangerous);
195 $this->assertNoText($dangerous); 195 $this->assertNoText($dangerous);
196 $this->assertText($sanitized); 196 $this->assertText($sanitized);
200 } 200 }
201 201
202 /** 202 /**
203 * Tests legacy field asserts which use xpath directly. 203 * Tests legacy field asserts which use xpath directly.
204 */ 204 */
205 public function testLegacyXpathAsserts() { 205 public function testXpathAsserts() {
206 $this->drupalGet('test-field-xpath'); 206 $this->drupalGet('test-field-xpath');
207 $this->assertFieldsByValue($this->xpath("//h1[@class = 'page-title']"), NULL); 207 $this->assertFieldsByValue($this->xpath("//h1[@class = 'page-title']"), NULL);
208 $this->assertFieldsByValue($this->xpath('//table/tbody/tr[2]/td[1]'), 'one'); 208 $this->assertFieldsByValue($this->xpath('//table/tbody/tr[2]/td[1]'), 'one');
209 $this->assertFieldByXPath('//table/tbody/tr[2]/td[1]', 'one'); 209 $this->assertFieldByXPath('//table/tbody/tr[2]/td[1]', 'one');
210 210
243 } 243 }
244 244
245 /** 245 /**
246 * Tests legacy field asserts using textfields. 246 * Tests legacy field asserts using textfields.
247 */ 247 */
248 public function testLegacyFieldAssertsForTextfields() { 248 public function testFieldAssertsForTextfields() {
249 $this->drupalGet('test-field-xpath'); 249 $this->drupalGet('test-field-xpath');
250 250
251 // *** 1. assertNoField(). 251 // *** 1. assertNoField().
252 $this->assertNoField('invalid_name_and_id'); 252 $this->assertNoField('invalid_name_and_id');
253 253
385 } 385 }
386 386
387 /** 387 /**
388 * Tests legacy field asserts for options field type. 388 * Tests legacy field asserts for options field type.
389 */ 389 */
390 public function testLegacyFieldAssertsForOptions() { 390 public function testFieldAssertsForOptions() {
391 $this->drupalGet('test-field-xpath'); 391 $this->drupalGet('test-field-xpath');
392 392
393 // Option field type. 393 // Option field type.
394 $this->assertOptionByText('options', 'one'); 394 $this->assertOptionByText('options', 'one');
395 try { 395 try {
441 } 441 }
442 442
443 /** 443 /**
444 * Tests legacy field asserts for button field type. 444 * Tests legacy field asserts for button field type.
445 */ 445 */
446 public function testLegacyFieldAssertsForButton() { 446 public function testFieldAssertsForButton() {
447 $this->drupalGet('test-field-xpath'); 447 $this->drupalGet('test-field-xpath');
448 448
449 $this->assertFieldById('edit-save', NULL); 449 $this->assertFieldById('edit-save', NULL);
450 // Test that the assertion fails correctly if the field value is passed in 450 // Test that the assertion fails correctly if the field value is passed in
451 // rather than the id. 451 // rather than the id.
483 } 483 }
484 484
485 /** 485 /**
486 * Tests legacy field asserts for checkbox field type. 486 * Tests legacy field asserts for checkbox field type.
487 */ 487 */
488 public function testLegacyFieldAssertsForCheckbox() { 488 public function testFieldAssertsForCheckbox() {
489 $this->drupalGet('test-field-xpath'); 489 $this->drupalGet('test-field-xpath');
490 490
491 // Part 1 - Test by name. 491 // Part 1 - Test by name.
492 // Test that checkboxes are found/not found correctly by name, when using 492 // Test that checkboxes are found/not found correctly by name, when using
493 // TRUE or FALSE to match their 'checked' state. 493 // TRUE or FALSE to match their 'checked' state.