send message from cli through ovh if configured

This commit is contained in:
2022-06-13 21:39:29 +02:00
parent 616be5cc8a
commit 4c0fef4f44
19 changed files with 540 additions and 57 deletions

View File

@@ -0,0 +1,89 @@
<?php
/**
* 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.
*/
declare(strict_types=1);
namespace Chill\CalendarBundle\Tests\Service\ShortMessageNotification;
use Chill\CalendarBundle\Service\ShortMessageNotification\DefaultRangeGenerator;
use DateTimeImmutable;
use Iterator;
use PHPUnit\Framework\TestCase;
/**
* @internal
* @coversNothing
*/
final class DefaultRangeGeneratorTest extends TestCase
{
/**
* * Lundi => Envoi des rdv du mardi et mercredi.
* * Mardi => Envoi des rdv du jeudi.
* * Mercredi => Envoi des rdv du vendredi
* * Jeudi => envoi des rdv du samedi et dimanche
* * Vendredi => Envoi des rdv du lundi.
*/
public function generateData(): Iterator
{
yield [
new DateTimeImmutable('2022-06-13 10:45:00'),
new DateTimeImmutable('2022-06-14 00:00:00'),
new DateTimeImmutable('2022-06-16 00:00:00'),
];
yield [
new DateTimeImmutable('2022-06-14 15:45:00'),
new DateTimeImmutable('2022-06-16 00:00:00'),
new DateTimeImmutable('2022-06-17 00:00:00'),
];
yield [
new DateTimeImmutable('2022-06-15 13:45:18'),
new DateTimeImmutable('2022-06-17 00:00:00'),
new DateTimeImmutable('2022-06-18 00:00:00'),
];
yield [
new DateTimeImmutable('2022-06-16 01:30:55'),
new DateTimeImmutable('2022-06-18 00:00:00'),
new DateTimeImmutable('2022-06-20 00:00:00'),
];
yield [
new DateTimeImmutable('2022-06-17 21:30:55'),
new DateTimeImmutable('2022-06-20 00:00:00'),
new DateTimeImmutable('2022-06-21 00:00:00'),
];
yield [
new DateTimeImmutable('2022-06-18 21:30:55'),
null,
null,
];
yield [
new DateTimeImmutable('2022-06-19 21:30:55'),
null,
null,
];
}
/**
* @dataProvider generateData
*/
public function testGenerateRange(DateTimeImmutable $date, ?DateTimeImmutable $startDate, ?DateTimeImmutable $endDate)
{
$generator = new DefaultRangeGenerator();
['startDate' => $actualStartDate, 'endDate' => $actualEndDate] = $generator->generateRange($date);
$this->assertEquals($startDate->format(DateTimeImmutable::ATOM), $actualStartDate->format(DateTimeImmutable::ATOM));
$this->assertEquals($endDate->format(DateTimeImmutable::ATOM), $actualEndDate->format(DateTimeImmutable::ATOM));
}
}