1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-31 15:24:31 +03:00

Exports: Made pdf command timeout configurable

Added test to cover.
For #5119
This commit is contained in:
Dan Brown
2024-09-27 16:33:58 +01:00
parent 42264f402d
commit 6103a22feb
4 changed files with 34 additions and 2 deletions

View File

@ -529,6 +529,22 @@ class ExportTest extends TestCase
}, PdfExportException::class);
}
public function test_pdf_command_timout_option_limits_export_time()
{
$page = $this->entities->page();
$command = 'php -r \'sleep(4);\'';
config()->set('exports.pdf_command', $command);
config()->set('exports.pdf_command_timeout', 1);
$this->assertThrows(function () use ($page) {
$start = time();
$this->withoutExceptionHandling()->asEditor()->get($page->getUrl('/export/pdf'));
$this->assertTrue(time() < ($start + 3));
}, PdfExportException::class,
"PDF Export via command failed due to timeout at 1 second(s)");
}
public function test_html_exports_contain_csp_meta_tag()
{
$entities = [