added annotation based exporter (#1831)

* added user exporter
* added project exporter
* added customer exporter
* added activity exporter
This commit is contained in:
Kevin Papst
2020-07-21 03:37:51 +02:00
committed by GitHub
parent 93a23f3fa3
commit aee063bb3c
79 changed files with 2980 additions and 215 deletions

View File

@@ -13,6 +13,7 @@ use App\DataFixtures\UserFixtures;
use App\Entity\User;
use App\Tests\KernelTestTrait;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\HttpFoundation\BinaryFileResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpKernel\HttpKernelBrowser;
@@ -341,4 +342,15 @@ abstract class ControllerBaseTest extends WebTestCase
self::assertTrue($client->getResponse()->headers->has('Location'), 'Could not find "Location" header');
self::assertStringEndsWith($url, $client->getResponse()->headers->get('Location'), 'Redirect URL does not match');
}
protected function assertExcelExportResponse(HttpKernelBrowser $client, string $prefix)
{
/** @var BinaryFileResponse $response */
$response = $client->getResponse();
self::assertInstanceOf(BinaryFileResponse::class, $response);
self::assertEquals('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', $response->headers->get('Content-Type'));
self::assertStringContainsString('attachment; filename=' . $prefix, $response->headers->get('Content-Disposition'));
self::assertStringContainsString('.xlsx', $response->headers->get('Content-Disposition'));
}
}