42 lines
1.6 KiB
PHP
42 lines
1.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Tests\Email;
|
|
|
|
use App\Entity\Destination;
|
|
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
|
|
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
|
|
use Symfony\Component\Mime\BodyRendererInterface;
|
|
|
|
/**
|
|
* The house manager reminder has to say what is pending - it used to be a bare headline.
|
|
*/
|
|
class ReminderPendingFeedbackTemplateTest extends KernelTestCase
|
|
{
|
|
public function testItListsEachTravelWithWhatIsOpen(): void
|
|
{
|
|
$destination = (new Destination())
|
|
->setProduct('Davos Klosters')
|
|
->setHotel('Schwendi')
|
|
->setDateFrom(new \DateTimeImmutable('2026-11-06'))
|
|
->setDateTo(new \DateTimeImmutable('2026-11-13'))
|
|
;
|
|
|
|
// rendered the way the mailer does, which also hands the layout its "email" variable
|
|
$email = (new TemplatedEmail())
|
|
->htmlTemplate('email/reminder_pending_feedback.html.twig')
|
|
->context(['travels' => [
|
|
['destination' => $destination, 'questionnaire' => 'draft', 'openRatings' => 2],
|
|
]])
|
|
;
|
|
self::getContainer()->get(BodyRendererInterface::class)->render($email);
|
|
$html = (string) $email->getHtmlBody();
|
|
|
|
$this->assertStringContainsString('06.11.2026 - 13.11.2026, Davos Klosters (Schwendi)', $html);
|
|
$this->assertStringContainsString('Fragebogen als Entwurf gespeichert, noch nicht abgeschickt', $html);
|
|
$this->assertStringContainsString('2 Teamer:innen noch nicht bewertet', $html);
|
|
$this->assertStringContainsString('/house-manager/pending-feedback', $html);
|
|
}
|
|
}
|