chill-bundles/src/Bundle/ChillMainBundle/Tests/Services/AddressGeographicalUnit/RefreshAddressToGeographicalUnitMaterializedViewCronJobTest.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\Services\AddressGeographicalUnit;
use Chill\MainBundle\Entity\CronJobExecution;
use DateTimeImmutable;
use Doctrine\DBAL\Connection;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
/**
* @internal
* @coversNothing
*/
final class RefreshAddressToGeographicalUnitMaterializedViewCronJobTest extends KernelTestCase
{
private Connection $connection;
protected function setUp(): void
{
parent::bootKernel();
$this->connection = self::$container->get(Connection::class);
}
public function testFullRun(): void
{
$job = new \Chill\MainBundle\Service\AddressGeographicalUnit\RefreshAddressToGeographicalUnitMaterializedViewCronJob(
$this->connection
);
$lastExecution = new CronJobExecution($job->getKey());
$lastExecution->setLastStart(new DateTimeImmutable('2 days ago'));
$this->assertIsBool($job->canRun($lastExecution));
$job->run();
}
}