Repo for the search and displace ingest module that takes odf, docx and pdf and transforms it into .md to be used with search and displace operations
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

38 lines
1.1 KiB

<?php
namespace Tests\Feature;
use App\Ingest\DocxReader;
use App\Ingest\DocxWriter;
use App\Jobs\RecreateDocument;
use Illuminate\Support\Facades\Storage;
use Tests\TestCase;
class ProcessDocxDocumentTest extends TestCase
{
/** @test */
public function it_reads_docx_documents_content()
{
$storage = Storage::disk('local');
// $reader = new DocxReader($storage, 'contracts/x.docx');
// $reader = new DocxReader($storage, 'contracts/y.docx');
// $reader = new DocxReader($storage, 'contracts/z.docx');
$reader = new DocxReader($storage, 'contracts/with-bookmarks.docx');
$result = $reader->execute();
$writer = new DocxWriter($storage, 'contracts/test-write.docx');
$writer->execute($result);
}
/** @test */
public function it_recreates_original_document_from_json()
{
// $data = Storage::disk('local')->get('contracts/x.json');
$data = Storage::disk('local')->get('contracts/a.json');
$data = json_decode($data, true);
$recreateDocument = new RecreateDocument('test123', $data);
$recreateDocument->handle();
}
}