Mercurial > hg > isophonics-drupal-site
comparison core/modules/contact/tests/src/Functional/ContactSitewideTest.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 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\Tests\contact\Functional; | 3 namespace Drupal\Tests\contact\Functional; |
4 | 4 |
5 use Drupal\Core\Url; | |
5 use Drupal\contact\Entity\ContactForm; | 6 use Drupal\contact\Entity\ContactForm; |
6 use Drupal\Core\Mail\MailFormatHelper; | 7 use Drupal\Core\Mail\MailFormatHelper; |
7 use Drupal\Core\Test\AssertMailTrait; | 8 use Drupal\Core\Test\AssertMailTrait; |
8 use Drupal\Tests\BrowserTestBase; | 9 use Drupal\Tests\BrowserTestBase; |
9 use Drupal\Core\Entity\EntityTypeInterface; | 10 use Drupal\Core\Entity\EntityTypeInterface; |
98 // User form could not be changed or deleted. | 99 // User form could not be changed or deleted. |
99 // Cannot use ::assertNoLinkByHref as it does partial url matching and with | 100 // Cannot use ::assertNoLinkByHref as it does partial url matching and with |
100 // field_ui enabled admin/structure/contact/manage/personal/fields exists. | 101 // field_ui enabled admin/structure/contact/manage/personal/fields exists. |
101 // @todo: See https://www.drupal.org/node/2031223 for the above. | 102 // @todo: See https://www.drupal.org/node/2031223 for the above. |
102 $edit_link = $this->xpath('//a[@href=:href]', [ | 103 $edit_link = $this->xpath('//a[@href=:href]', [ |
103 ':href' => \Drupal::url('entity.contact_form.edit_form', ['contact_form' => 'personal']), | 104 ':href' => Url::fromRoute('entity.contact_form.edit_form', ['contact_form' => 'personal'])->toString(), |
104 ]); | 105 ]); |
105 $this->assertTrue(empty($edit_link), format_string('No link containing href %href found.', | 106 $this->assertTrue(empty($edit_link), format_string('No link containing href %href found.', |
106 ['%href' => 'admin/structure/contact/manage/personal'] | 107 ['%href' => 'admin/structure/contact/manage/personal'] |
107 )); | 108 )); |
108 $this->assertNoLinkByHref('admin/structure/contact/manage/personal/delete'); | 109 $this->assertNoLinkByHref('admin/structure/contact/manage/personal/delete'); |
278 | 279 |
279 // Test field UI and field integration. | 280 // Test field UI and field integration. |
280 $this->drupalGet('admin/structure/contact'); | 281 $this->drupalGet('admin/structure/contact'); |
281 | 282 |
282 $view_link = $this->xpath('//table/tbody/tr/td/a[contains(@href, :href) and text()=:text]', [ | 283 $view_link = $this->xpath('//table/tbody/tr/td/a[contains(@href, :href) and text()=:text]', [ |
283 ':href' => \Drupal::url('entity.contact_form.canonical', ['contact_form' => $contact_form]), | 284 ':href' => Url::fromRoute('entity.contact_form.canonical', ['contact_form' => $contact_form])->toString(), |
284 ':text' => $label, | 285 ':text' => $label, |
285 ] | 286 ] |
286 ); | 287 ); |
287 $this->assertTrue(!empty($view_link), 'Contact listing links to contact form.'); | 288 $this->assertTrue(!empty($view_link), 'Contact listing links to contact form.'); |
288 | 289 |
553 | 554 |
554 /** | 555 /** |
555 * Deletes all forms. | 556 * Deletes all forms. |
556 */ | 557 */ |
557 public function deleteContactForms() { | 558 public function deleteContactForms() { |
558 $contact_forms = ContactForm::loadMultiple();; | 559 $contact_forms = ContactForm::loadMultiple(); |
559 foreach ($contact_forms as $id => $contact_form) { | 560 foreach ($contact_forms as $id => $contact_form) { |
560 if ($id == 'personal') { | 561 if ($id == 'personal') { |
561 // Personal form could not be deleted. | 562 // Personal form could not be deleted. |
562 $this->drupalGet("admin/structure/contact/manage/$id/delete"); | 563 $this->drupalGet("admin/structure/contact/manage/$id/delete"); |
563 $this->assertResponse(403); | 564 $this->assertResponse(403); |