5.2.  Test Multiple PDF Documents

The following code shows how to use multiple documents in one test.

lives_ok {
    my $pdf1 = "$resources_dir/document_en.pdf";
    my $pdf2 = "$resources_dir/document_es.pdf";
    my $pdf3 = "$resources_dir/document_de.pdf";
    my $pdfArray = [$pdf1, $pdf2, $pdf3];
  
    my $expectedDate = "28.09.2014";
    my $expectedDocumentID = "XX-123";
  
    AssertThat->eachDocument($pdfArray)
              ->restrictedTo(FIRST_PAGE)
              ->hasText()
              ->containing($expectedDate)
              ->containing($expectedDocumentID)
    ;
} "same text in multiple document";

The PDF documents are passed to the method eachDocument() as a String[]. Also, the types File[], InputStream[] and URL[] can be used.