Compare commits

..

No commits in common. "3b63a73161b2585af2650c56c1caf7d75bde3745" and "96cf0b7dd54f60e71df4031308ae33200bb0e1ac" have entirely different histories.

3 changed files with 12 additions and 27 deletions

View File

@ -27,7 +27,7 @@ class PreventionRememberAction
return;
}
$body = app(PreventionSettings::class)->refresh()->formmail
$body = app(PreventionSettings::class)->formmail
->placeholder('formname', $participant->form->name)
->append($participant->form->prevention_text);

View File

@ -42,14 +42,15 @@ class EditorData extends Data implements Editorable
public function append(Editorable $editorable): self
{
$this->blocks = array_merge($this->blocks, $editorable->toEditorData()->blocks);
return $this;
return self::from([
...$this->toArray(),
'blocks' => array_merge($this->blocks, $editorable->toEditorData()->blocks),
]);
}
public function replaceWithList(string $blockContent, array $replacements): self
{
$this->blocks = collect($this->blocks)->map(function ($block) use ($blockContent, $replacements) {
$blocks = collect($this->blocks)->map(function ($block) use ($blockContent, $replacements) {
if (data_get($block, 'type') !== 'paragraph') {
return $block;
}
@ -71,8 +72,10 @@ class EditorData extends Data implements Editorable
return $block;
})->toArray();
return $this;
return self::from([
...$this->toArray(),
'blocks' => $blocks,
]);
}
public function toEditorData(): EditorData

View File

@ -186,7 +186,7 @@ class PreventionTest extends TestCase
public function testItRendersSetttingMail(): void
{
Mail::fake();
app(PreventionSettings::class)->fill([
app(PreventionSettings::class)->fake([
'formmail' => EditorRequestFactory::new()->paragraphs(["lorem lala {formname} g", "{wanted}", "bbb"])->toData()
])->save();
$form = $this->createForm();
@ -203,7 +203,7 @@ class PreventionTest extends TestCase
public function testItAppendsTextOfForm(): void
{
Mail::fake();
app(PreventionSettings::class)->fill([
app(PreventionSettings::class)->fake([
'formmail' => EditorRequestFactory::new()->paragraphs(["::first::"])->toData()
])->save();
$form = $this->createForm();
@ -217,24 +217,6 @@ class PreventionTest extends TestCase
]));
}
public function testItDoesntAppendTextTwice(): void
{
Mail::fake();
app(PreventionSettings::class)->fill(['frommail' => EditorRequestFactory::new()->paragraphs(["::first::"])->toData()])->save();
tap($this->createForm(), function ($f) {
$f->update(['prevention_text' => EditorRequestFactory::new()->paragraphs(['oberhausen'])->toData()]);
$this->createParticipant($f);
});
tap($this->createForm(), function ($f) {
$f->update(['prevention_text' => EditorRequestFactory::new()->paragraphs(['siegburg'])->toData()]);
$this->createParticipant($f);
});
PreventionRememberAction::run();
Mail::assertSent(PreventionRememberMail::class, fn ($mail) => $mail->bodyText->hasAll(['oberhausen']) && !$mail->bodyText->hasAll(['siegburg']));
}
public function testItDisplaysBodyTextInMail(): void
{
$form = $this->createForm();