Skip to content

Update tests due to escaping of all arguments now #340

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tests/ImageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function testCanOptionsInConstructor()

$tmpFile = $image->getimageFilename();
$this->assertFileExists($outFile);
$this->assertEquals("$binary --transparent --width '800' --allow '/tmp' --allow '/test' '$inFile' '$tmpFile'", (string) $image->getCommand());
$this->assertEquals("$binary '--transparent' '--width' '800' '--allow' '/tmp' '--allow' '/test' '$inFile' '$tmpFile'", (string) $image->getCommand());
unlink($outFile);
}
public function testCanSetOptions()
Expand All @@ -164,7 +164,7 @@ public function testCanSetOptions()

$tmpFile = $image->getimageFilename();
$this->assertFileExists($outFile);
$this->assertEquals("$binary --transparent --width '800' --allow '/tmp' --allow '/test' '$inFile' '$tmpFile'", (string) $image->getCommand());
$this->assertEquals("$binary '--transparent' '--width' '800' '--allow' '/tmp' '--allow' '/test' '$inFile' '$tmpFile'", (string) $image->getCommand());
unlink($outFile);
}

Expand Down
20 changes: 10 additions & 10 deletions tests/PdfTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public function testCanAddCoverFromFile()

$tmpFile = $pdf->getPdfFilename();
$command = (string)$pdf->getCommand();
$this->assertEquals("$binary cover '$inFile' '$tmpFile'", $command);
$this->assertEquals("$binary 'cover' '$inFile' '$tmpFile'", $command);
unlink($outFile);
}
public function testCanAddCoverFromHtmlString()
Expand All @@ -210,7 +210,7 @@ public function testCanAddCoverFromHtmlString()
$this->assertFileExists($outFile);

$tmpFile = $pdf->getPdfFilename();
$this->assertRegExp("#$binary cover '[^ ]+' '$tmpFile'#", (string) $pdf->getCommand());
$this->assertRegExp("#$binary 'cover' '[^ ]+' '$tmpFile'#", (string) $pdf->getCommand());
unlink($outFile);
}
public function testCanAddCoverFromUrl()
Expand All @@ -226,7 +226,7 @@ public function testCanAddCoverFromUrl()
$this->assertFileExists($outFile);

$tmpFile = $pdf->getPdfFilename();
$this->assertEquals("$binary cover '$url' '$tmpFile'", (string) $pdf->getCommand());
$this->assertEquals("$binary 'cover' '$url' '$tmpFile'", (string) $pdf->getCommand());
unlink($outFile);
}

Expand All @@ -243,7 +243,7 @@ public function testCanAddToc()
$this->assertFileExists($outFile);

$tmpFile = $pdf->getPdfFilename();
$this->assertRegExp("#$binary '[^ ]+' toc '$tmpFile'#", (string) $pdf->getCommand());
$this->assertRegExp("#$binary '[^ ]+' 'toc' '$tmpFile'#", (string) $pdf->getCommand());
unlink($outFile);
}

Expand Down Expand Up @@ -287,7 +287,7 @@ public function testCanPassGlobalOptionsInConstructor()
$this->assertTrue($pdf->saveAs($outFile));

$this->assertFileExists($outFile);
$this->assertRegExp("#$binary --header-html '$tmpDir/tmp_wkhtmlto_pdf_[^ ]+\.html' --no-outline --margin-top '0' --allow '/tmp' --allow '/test' '$inFile' '$tmpDir/tmp_wkhtmlto_pdf_[^ ]+\.pdf'#", (string) $pdf->getCommand());
$this->assertRegExp("#$binary '--header-html' '$tmpDir/tmp_wkhtmlto_pdf_[^ ]+\.html' '--no-outline' '--margin-top' '0' '--allow' '/tmp' '--allow' '/test' '$inFile' '$tmpDir/tmp_wkhtmlto_pdf_[^ ]+\.pdf'#", (string) $pdf->getCommand());
unlink($outFile);
}
public function testCanSetGlobalOptions()
Expand All @@ -307,7 +307,7 @@ public function testCanSetGlobalOptions()
$this->assertFileExists($outFile);

$tmpFile = $pdf->getPdfFilename();
$this->assertEquals("$binary --no-outline --margin-top '0' '$inFile' '$tmpFile'", (string) $pdf->getCommand());
$this->assertEquals("$binary '--no-outline' '--margin-top' '0' '$inFile' '$tmpFile'", (string) $pdf->getCommand());
unlink($outFile);
}
public function testSetPageCoverAndTocOptions()
Expand Down Expand Up @@ -344,7 +344,7 @@ public function testSetPageCoverAndTocOptions()
$this->assertFileExists($outFile);

$tmpFile = $pdf->getPdfFilename();
$this->assertEquals("$binary --no-outline --margin-top '0' --header-center 'test {x} {y}' '$inFile' --no-background --zoom '1.5' --cookie 'name' 'value' --replace 'x' 'v' --replace 'y' '' cover '$inFile' --replace 'x' 'a' --replace 'y' 'b' toc --disable-dotted-lines '$tmpFile'", (string) $pdf->getCommand());
$this->assertEquals("$binary '--no-outline' '--margin-top' '0' '--header-center' 'test {x} {y}' '$inFile' '--no-background' '--zoom' '1.5' '--cookie' 'name' 'value' '--replace' 'x' 'v' '--replace' 'y' '' 'cover' '$inFile' '--replace' 'x' 'a' '--replace' 'y' 'b' 'toc' '--disable-dotted-lines' '$tmpFile'", (string) $pdf->getCommand());
unlink($outFile);
}
public function testCanAddHeaderAndFooterAsHtml()
Expand All @@ -363,7 +363,7 @@ public function testCanAddHeaderAndFooterAsHtml()
$this->assertFileExists($outFile);

$tmpFile = $pdf->getPdfFilename();
$this->assertRegExp("#$binary --header-html '/tmp/[^ ]+' --footer-html '/tmp/[^ ]+' '$inFile' '$tmpFile'#", (string) $pdf->getCommand());
$this->assertRegExp("#$binary '--header-html' '/tmp/[^ ]+' '--footer-html' '/tmp/[^ ]+' '$inFile' '$tmpFile'#", (string) $pdf->getCommand());
unlink($outFile);
}
public function testCanAddHeaderAndFooterAsFile()
Expand All @@ -382,7 +382,7 @@ public function testCanAddHeaderAndFooterAsFile()
$this->assertFileExists($outFile);

$tmpFile = $pdf->getPdfFilename();
$this->assertRegExp("#$binary --header-html '/tmp/[^ ]+' --footer-html '/tmp/[^ ]+' '$inFile' '$tmpFile'#", (string) $pdf->getCommand());
$this->assertRegExp("#$binary '--header-html' '/tmp/[^ ]+' '--footer-html' '/tmp/[^ ]+' '$inFile' '$tmpFile'#", (string) $pdf->getCommand());
unlink($outFile);
}
public function testCanAddHeaderAndFooterAsHtmlToPagesAndCoverAndToc()
Expand Down Expand Up @@ -410,7 +410,7 @@ public function testCanAddHeaderAndFooterAsHtmlToPagesAndCoverAndToc()
$this->assertFileExists($outFile);

$tmpFile = $pdf->getPdfFilename();
$this->assertRegExp("#$binary '/tmp/[^ ]+\.html' --header-html '/tmp/[^ ]+\.html' --footer-html '/tmp/[^ ]+\.html' cover '$inFile' --header-html '/tmp/[^ ]+\.html' --footer-html '/tmp/[^ ]+\.html' toc --header-html '/tmp/[^ ]+\.html' --footer-html '/tmp/[^ ]+\.html' '$tmpFile'#", (string) $pdf->getCommand());
$this->assertRegExp("#$binary '/tmp/[^ ]+\.html' '--header-html' '/tmp/[^ ]+\.html' '--footer-html' '/tmp/[^ ]+\.html' 'cover' '$inFile' '--header-html' '/tmp/[^ ]+\.html' '--footer-html' '/tmp/[^ ]+\.html' 'toc' '--header-html' '/tmp/[^ ]+\.html' '--footer-html' '/tmp/[^ ]+\.html' '$tmpFile'#", (string) $pdf->getCommand());
unlink($outFile);
}

Expand Down