use BookStack\Entities\Tools\PageContent;
use BookStack\Uploads\Attachment;
use BookStack\Uploads\Image;
+use FilesystemIterator;
use Illuminate\Support\Carbon;
use Illuminate\Testing\TestResponse;
use Tests\TestCase;
$this->assertEquals($instanceId, $zipInstanceId);
}
+ public function test_export_leaves_no_temp_files()
+ {
+ $tempDir = sys_get_temp_dir();
+ $startTempFileCount = iterator_count((new FileSystemIterator($tempDir, FilesystemIterator::SKIP_DOTS)));
+
+ $page = $this->entities->pageWithinChapter();
+ $this->asEditor();
+ $pageResp = $this->get($page->getUrl("/export/zip"));
+ $pageResp->streamedContent();
+ $pageResp->assertOk();
+ $this->get($page->chapter->getUrl("/export/zip"))->assertOk();
+ $this->get($page->book->getUrl("/export/zip"))->assertOk();
+
+ $afterTempFileCount = iterator_count((new FileSystemIterator($tempDir, FilesystemIterator::SKIP_DOTS)));
+
+ $this->assertEquals($startTempFileCount, $afterTempFileCount);
+ }
+
public function test_page_export()
{
$page = $this->entities->page();