mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2026-01-15 05:41:25 +00:00
Partage d'export enregistré et génération asynchrone des exports
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?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\Controller;
|
||||
|
||||
use Chill\DocStoreBundle\Entity\StoredObject;
|
||||
use Chill\MainBundle\Controller\ExportGenerationController;
|
||||
use Chill\MainBundle\Entity\ExportGeneration;
|
||||
use Chill\MainBundle\Export\ExportManager;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Prophecy\Argument;
|
||||
use Prophecy\PhpUnit\ProphecyTrait;
|
||||
use Symfony\Component\Security\Core\Security;
|
||||
use Symfony\Component\Serializer\SerializerInterface;
|
||||
use Twig\Environment;
|
||||
use function PHPUnit\Framework\assertEquals;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
class ExportGenerationControllerTest extends TestCase
|
||||
{
|
||||
use ProphecyTrait;
|
||||
|
||||
public function testObjectStatus(): void
|
||||
{
|
||||
$security = $this->prophesize(Security::class);
|
||||
$security->isGranted('ROLE_USER')->willReturn(true);
|
||||
$environment = $this->prophesize(Environment::class);
|
||||
$serializer = $this->prophesize(SerializerInterface::class);
|
||||
$serializer->serialize(Argument::any(), 'json', ['groups' => ['read']])->willReturn('{}');
|
||||
$exportManager = $this->prophesize(ExportManager::class);
|
||||
|
||||
$pending = new ExportGeneration('dummy', []);
|
||||
|
||||
$controller = new ExportGenerationController($security->reveal(), $environment->reveal(), $serializer->reveal(), $exportManager->reveal());
|
||||
|
||||
$actual = $controller->objectStatus($pending);
|
||||
self::assertEquals('{}', $actual->getContent());
|
||||
|
||||
$generated = new ExportGeneration('dummy', []);
|
||||
$generated->getStoredObject()->setStatus(StoredObject::STATUS_READY);
|
||||
|
||||
self:assertEquals('{}', $controller->objectStatus($generated)->getContent());
|
||||
}
|
||||
}
|
||||
@@ -21,13 +21,13 @@ use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
||||
*
|
||||
* @coversNothing
|
||||
*/
|
||||
final class ExportControllerTest extends WebTestCase
|
||||
final class ExportIndexControllerTest extends WebTestCase
|
||||
{
|
||||
use PrepareClientTrait;
|
||||
|
||||
public function testIndex()
|
||||
{
|
||||
$client = $this->getClientAuthenticatedAsAdmin();
|
||||
$client = $this->getClientAuthenticated();
|
||||
|
||||
$client->request('GET', '/fr/exports/');
|
||||
|
||||
Reference in New Issue
Block a user