mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-21 07:03:49 +00:00
Feature: [cron] Create a cron job to refresh materialized view address - geographical unit association
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user