public function RecipientPluginUpdatePathTest::testUpdatePath in Workbench Email 8
Same name and namespace in other branches
- 2.x tests/src/Functional/RecipientPluginUpdatePathTest.php \Drupal\Tests\workbench_email\Functional\RecipientPluginUpdatePathTest::testUpdatePath()
Tests workbench_email_update_8001().
File
- tests/
src/ Functional/ RecipientPluginUpdatePathTest.php, line 27
Class
- RecipientPluginUpdatePathTest
- Defines a class for testing upgrade path.
Namespace
Drupal\Tests\workbench_email\FunctionalCode
public function testUpdatePath() {
if (Semver::satisfies(\Drupal::VERSION, '~9')) {
$this
->markTestSkipped('This test is only for Drupal 8');
}
$this->container
->get('module_installer')
->install([
'block',
]);
$this
->runUpdates();
$entity_type_manager = $this->container
->get('entity_type.manager');
/** @var \Drupal\workbench_email\TemplateInterface $template */
$template = $entity_type_manager
->getStorage('workbench_email_template')
->load('send');
$nodes = $entity_type_manager
->getStorage('node')
->loadByProperties([
'title' => 'test node',
]);
$recipients = $template
->getRecipients(reset($nodes));
$expected = [
// User with approver role.
'bob@example.com',
// Author.
'admin@example.com',
// Email field on node.
'terri@example.com',
];
$this
->assertEquals(sort($expected), sort($recipients));
$this
->assertNull($template
->get('author'));
$this
->assertNull($template
->get('fields'));
$this
->assertNull($template
->get('roles'));
}