Files
chill-bundles/src/Bundle/ChillMainBundle/Tests/Notification/Email/DailyNotificationDigestCronJobFunctionalTest.php

47 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
/*
* Chill is a software for social workers
*
* For the full copyright and license information, please view
* the LICENSE file that was distributed with this source code.
*/
namespace Chill\MainBundle\Tests\Notification\Email;
use Chill\MainBundle\Notification\Email\DailyNotificationDigestCronjob;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
/**
* Run functional test on the cronjob.
*
* @internal
*
* @coversNothing
*/
class DailyNotificationDigestCronJobFunctionalTest extends KernelTestCase
{
private DailyNotificationDigestCronjob $dailyNotificationDigestCronjob;
protected function setUp(): void
{
self::bootKernel();
$this->dailyNotificationDigestCronjob = self::getContainer()->get(DailyNotificationDigestCronjob::class);
}
public function testRunWithNullPreviousExecutionData(): void
{
$actual = $this->dailyNotificationDigestCronjob->run([]);
self::assertArrayHasKey('last_execution', $actual);
self::assertInstanceOf(
\DateTimeImmutable::class,
\DateTimeImmutable::createFromFormat('Y-m-d-H:i:s.u e', $actual['last_execution']),
'test that the string can be converted to a date'
);
}
}