-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Tomsgu\PdfMerger\Test\Unit; | ||
|
||
use PHPUnit\Framework\TestCase; | ||
use setasign\Fpdi\Fpdi; | ||
use Tomsgu\PdfMerger\Exception\InvalidArgumentException; | ||
use Tomsgu\PdfMerger\PdfCollection; | ||
use Tomsgu\PdfMerger\PdfMerger; | ||
|
||
/** | ||
* @author Tomas Jakl <[email protected]> | ||
*/ | ||
class PdfMergerTest extends TestCase | ||
{ | ||
const TEST_FILE = './tests/Data/landscape.pdf'; | ||
|
||
public function testEmptyCollection() | ||
{ | ||
$collection = new PdfCollection(); | ||
$fpdi = new Fpdi(); | ||
$merger = new PdfMerger($fpdi); | ||
|
||
$this->expectException(InvalidArgumentException::class); | ||
$merger->merge($collection, 'new_file.pdf', PdfMerger::MODE_FILE); | ||
} | ||
|
||
public function testInvalidMode() | ||
{ | ||
$collection = new PdfCollection(); | ||
$collection->addPdf(self::TEST_FILE); | ||
$fpdi = new Fpdi(); | ||
$merger = new PdfMerger($fpdi); | ||
|
||
$this->expectException(InvalidArgumentException::class); | ||
$merger->merge($collection, 'new_file.pdf', 'ZZZ'); | ||
} | ||
} |