namespace Drupal\Tests\contact\Functional;
-use Drupal\Component\Utility\Unicode;
use Drupal\contact\Entity\ContactForm;
use Drupal\Core\Mail\MailFormatHelper;
use Drupal\Core\Test\AssertMailTrait;
-use Drupal\field_ui\Tests\FieldUiTestTrait;
use Drupal\Tests\BrowserTestBase;
use Drupal\Core\Entity\EntityTypeInterface;
+use Drupal\Tests\field_ui\Traits\FieldUiTestTrait;
use Drupal\user\RoleInterface;
/**
// field_ui enabled admin/structure/contact/manage/personal/fields exists.
// @todo: See https://www.drupal.org/node/2031223 for the above.
$edit_link = $this->xpath('//a[@href=:href]', [
- ':href' => \Drupal::url('entity.contact_form.edit_form', ['contact_form' => 'personal'])
+ ':href' => \Drupal::url('entity.contact_form.edit_form', ['contact_form' => 'personal']),
]);
$this->assertTrue(empty($edit_link), format_string('No link containing href %href found.',
['%href' => 'admin/structure/contact/manage/personal']
$recipients = ['simpletest&@example.com', 'simpletest2@example.com', 'simpletest3@example.com'];
$max_length = EntityTypeInterface::BUNDLE_MAX_LENGTH;
$max_length_exceeded = $max_length + 1;
- $this->addContactForm($id = Unicode::strtolower($this->randomMachineName($max_length_exceeded)), $label = $this->randomMachineName($max_length_exceeded), implode(',', [$recipients[0]]), '', TRUE);
+ $this->addContactForm($id = mb_strtolower($this->randomMachineName($max_length_exceeded)), $label = $this->randomMachineName($max_length_exceeded), implode(',', [$recipients[0]]), '', TRUE);
$this->assertText(format_string('Machine-readable name cannot be longer than @max characters but is currently @exceeded characters long.', ['@max' => $max_length, '@exceeded' => $max_length_exceeded]));
- $this->addContactForm($id = Unicode::strtolower($this->randomMachineName($max_length)), $label = $this->randomMachineName($max_length), implode(',', [$recipients[0]]), '', TRUE);
+ $this->addContactForm($id = mb_strtolower($this->randomMachineName($max_length)), $label = $this->randomMachineName($max_length), implode(',', [$recipients[0]]), '', TRUE);
$this->assertText(t('Contact form @label has been added.', ['@label' => $label]));
// Verify that the creation message contains a link to a contact form.
$this->assert(isset($view_link), 'The message area contains a link to a contact form.');
// Create first valid form.
- $this->addContactForm($id = Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0]]), '', TRUE);
+ $this->addContactForm($id = mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0]]), '', TRUE);
$this->assertText(t('Contact form @label has been added.', ['@label' => $label]));
// Verify that the creation message contains a link to a contact form.
$this->drupalLogin($admin_user);
// Add more forms.
- $this->addContactForm(Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0], $recipients[1]]), '', FALSE);
+ $this->addContactForm(mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0], $recipients[1]]), '', FALSE);
$this->assertText(t('Contact form @label has been added.', ['@label' => $label]));
- $this->addContactForm($name = Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0], $recipients[1], $recipients[2]]), '', FALSE);
+ $this->addContactForm($name = mb_strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', [$recipients[0], $recipients[1], $recipients[2]]), '', FALSE);
$this->assertText(t('Contact form @label has been added.', ['@label' => $label]));
// Try adding a form that already exists.
$label = $this->randomMachineName(16);
$recipients = implode(',', [$recipients[0], $recipients[1], $recipients[2]]);
- $contact_form = Unicode::strtolower($this->randomMachineName(16));
+ $contact_form = mb_strtolower($this->randomMachineName(16));
$this->addContactForm($contact_form, $label, $recipients, '', FALSE);
$this->drupalGet('admin/structure/contact');
$this->clickLink(t('Edit'));
$this->assertResponse(200);
// Create a simple textfield.
- $field_name = Unicode::strtolower($this->randomMachineName());
+ $field_name = mb_strtolower($this->randomMachineName());
$field_label = $this->randomMachineName();
$this->fieldUIAddNewField(NULL, $field_name, $field_label, 'text');
$field_name = 'field_' . $field_name;
'administer contact forms',
'administer permissions',
'administer users',
- 'access site reports'
+ 'access site reports',
]);
$this->drupalLogin($admin_user);