Add CTAs to daily emails
Add a daily email CTA node type and reference field to attach a CTA to a daily email. Also update the RSS feed view to include the referenced body field value.
This commit is contained in:
parent
76868079ac
commit
2d55ea78f1
24 changed files with 1058 additions and 3 deletions
|
@ -0,0 +1,45 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Drupal\Tests\opd_daily_emails\Functional;
|
||||
|
||||
use weitzman\DrupalTestTraits\ExistingSiteBase;
|
||||
|
||||
final class CallToActionTest extends ExistingSiteBase {
|
||||
|
||||
public function test_saving_an_email_node_without_a_cta_will_populate_one(): void {
|
||||
$cta = $this->createNode([
|
||||
'type' => 'daily_email_cta',
|
||||
]);
|
||||
|
||||
$email = $this->createNode([
|
||||
'field_daily_email_cta' => NULL,
|
||||
'type' => 'daily_email',
|
||||
]);
|
||||
|
||||
$this->assertNotEmpty($email->get('field_daily_email_cta')->getValue());
|
||||
|
||||
// TODO: assert the returned text.
|
||||
}
|
||||
|
||||
public function test_saving_an_email_node_with_a_cta_will_keep_the_same_cta(): void {
|
||||
$cta = $this->createNode([
|
||||
'type' => 'daily_email_cta',
|
||||
]);
|
||||
|
||||
$email = $this->createNode([
|
||||
'field_daily_email_cta' => $cta,
|
||||
'type' => 'daily_email',
|
||||
]);
|
||||
|
||||
$email->set('title', 'Updated');
|
||||
$email->save();
|
||||
|
||||
$this->assertSame(
|
||||
actual: $email->get('field_daily_email_cta')->getValue()[0]['target_id'],
|
||||
expected: $cta->id(),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue