-
-
Notifications
You must be signed in to change notification settings - Fork 229
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
1 parent
557c509
commit 4b6a23f
Showing
1 changed file
with
11 additions
and
13 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 |
---|---|---|
@@ -1,70 +1,68 @@ | ||
<?php | ||
|
||
use Spatie\PdfToImage\Pdf; | ||
use Spatie\PdfToImage\Enums\ResourceLimitType; | ||
use Spatie\PdfToImage\Pdf; | ||
|
||
it('sets the area resource limit', function () { | ||
$pdf = new Pdf($this->testFile); | ||
$im = $pdf->resourceLimit(ResourceLimitType::Area, 1024 * 1024 * 16) | ||
->getImageData($this->testFile, 1); | ||
|
||
expect((int)$im::getResourceLimit(ResourceLimitType::Area->value))->toBe((int)1024*1024*16); | ||
expect((int) $im::getResourceLimit(ResourceLimitType::Area->value))->toBe((int) 1024 * 1024 * 16); | ||
}); | ||
|
||
it('sets the disk resource limit', function () { | ||
$pdf = new Pdf($this->testFile); | ||
$im = $pdf->resourceLimit(ResourceLimitType::Disk, 1024 * 1024) | ||
->getImageData($this->testFile, 1); | ||
|
||
expect((int)$im::getResourceLimit(ResourceLimitType::Disk->value))->toBe((int)1024*1024); | ||
expect((int) $im::getResourceLimit(ResourceLimitType::Disk->value))->toBe((int) 1024 * 1024); | ||
}); | ||
|
||
it('sets the file resource limit', function () { | ||
$pdf = new Pdf($this->testFile); | ||
$im = $pdf->resourceLimit(ResourceLimitType::File, 5) | ||
->getImageData($this->testFile, 1); | ||
|
||
expect((int)$im::getResourceLimit(ResourceLimitType::File->value))->toBe((int)5); | ||
expect((int) $im::getResourceLimit(ResourceLimitType::File->value))->toBe((int) 5); | ||
}); | ||
|
||
|
||
it('sets the map resource limit', function () { | ||
$pdf = new Pdf($this->testFile); | ||
$im = $pdf->resourceLimit(ResourceLimitType::Map, 1024 * 1024*16) | ||
$im = $pdf->resourceLimit(ResourceLimitType::Map, 1024 * 1024 * 16) | ||
->getImageData($this->testFile, 1); | ||
|
||
expect((int)$im::getResourceLimit(ResourceLimitType::Map->value))->toBe((int)1024*1024*16); | ||
expect((int) $im::getResourceLimit(ResourceLimitType::Map->value))->toBe((int) 1024 * 1024 * 16); | ||
}); | ||
|
||
it('sets the memory resource limit', function () { | ||
$pdf = new Pdf($this->testFile); | ||
$im = $pdf->resourceLimit(ResourceLimitType::Memory, 1024 * 1024*32) | ||
$im = $pdf->resourceLimit(ResourceLimitType::Memory, 1024 * 1024 * 32) | ||
->getImageData($this->testFile, 1); | ||
|
||
expect((int)$im::getResourceLimit(ResourceLimitType::Memory->value))->toBe((int)1024*1024*32); | ||
expect((int) $im::getResourceLimit(ResourceLimitType::Memory->value))->toBe((int) 1024 * 1024 * 32); | ||
}); | ||
|
||
it('sets the time resource limit', function () { | ||
$pdf = new Pdf($this->testFile); | ||
$im = $pdf->resourceLimit(ResourceLimitType::Time, 10) | ||
->getImageData($this->testFile, 1); | ||
|
||
expect((int)$im::getResourceLimit(ResourceLimitType::Time->value))->toBe((int)10); | ||
expect((int) $im::getResourceLimit(ResourceLimitType::Time->value))->toBe((int) 10); | ||
}); | ||
|
||
it('sets the throttle resource limit', function () { | ||
$pdf = new Pdf($this->testFile); | ||
$im = $pdf->resourceLimit(ResourceLimitType::Throttle, 10) | ||
->getImageData($this->testFile, 1); | ||
|
||
expect((int)$im::getResourceLimit(ResourceLimitType::Throttle->value))->toBe((int)10); | ||
expect((int) $im::getResourceLimit(ResourceLimitType::Throttle->value))->toBe((int) 10); | ||
}); | ||
|
||
it('sets the thread resource limit', function () { | ||
$pdf = new Pdf($this->testFile); | ||
$im = $pdf->resourceLimit(ResourceLimitType::Thread, 4) | ||
->getImageData($this->testFile, 1); | ||
|
||
expect((int)$im::getResourceLimit(ResourceLimitType::Thread->value))->toBe((int)4); | ||
expect((int) $im::getResourceLimit(ResourceLimitType::Thread->value))->toBe((int) 4); | ||
}); | ||
|