WebformScheduledEmailTranslationTest.php in Webform 8.5
File
modules/webform_scheduled_email/tests/src/Functional/WebformScheduledEmailTranslationTest.php
View source
<?php
namespace Drupal\Tests\webform_scheduled_email\Functional;
use Drupal\Tests\webform_node\Functional\WebformNodeBrowserTestBase;
use Drupal\webform\Entity\Webform;
class WebformScheduledEmailTranslationTest extends WebformNodeBrowserTestBase {
public static $modules = [
'webform',
'webform_scheduled_email',
'webform_scheduled_email_test_translation',
];
public function testWebformScheduledEmailTranslation() {
$webform_schedule = Webform::load('test_handler_scheduled_translate');
$scheduled_manager = \Drupal::service('webform_scheduled_email.manager');
$this
->drupalPostForm('/webform/' . $webform_schedule
->id(), [], 'Submit');
$scheduled_manager
->cron();
$sent_email = $this
->getLastEmail();
$this
->assertEqual($sent_email['subject'], 'English Subject');
$this
->assertEqual($sent_email['body'], 'English Body' . PHP_EOL);
$this
->drupalPostForm('/es/webform/' . $webform_schedule
->id(), [], 'Submit');
$scheduled_manager
->cron();
$sent_email = $this
->getLastEmail();
$this
->assertEqual($sent_email['subject'], 'Spanish Subject');
$this
->assertEqual($sent_email['body'], 'Spanish Body' . PHP_EOL);
}
}