mirror of
https://github.com/snipe/snipe-it.git
synced 2025-10-29 11:21:21 +00:00
Avoid dumping pdf contents to test results
This commit is contained in:
parent
bb68ed3ad9
commit
18d0a04efc
@ -25,6 +25,16 @@ class Label implements View
|
||||
*/
|
||||
protected $data;
|
||||
|
||||
|
||||
/**
|
||||
* TCPDF output destination.
|
||||
* "I" - inline by default.
|
||||
* See TCPDF's Output method for details.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private string $destination = 'I';
|
||||
|
||||
public function __construct() {
|
||||
$this->data = new Collection();
|
||||
}
|
||||
@ -222,7 +232,7 @@ class Label implements View
|
||||
$template->writeAll($pdf, $data);
|
||||
|
||||
$filename = $assets->count() > 1 ? 'assets.pdf' : $assets->first()->asset_tag.'.pdf';
|
||||
$pdf->Output($filename, 'I');
|
||||
$pdf->Output($filename, $this->destination);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -7,6 +7,7 @@ use App\Models\Location;
|
||||
use App\Models\Setting;
|
||||
use App\View\Label;
|
||||
use Tests\TestCase;
|
||||
use function Livewire\invade;
|
||||
|
||||
class LabelTest extends TestCase
|
||||
{
|
||||
@ -32,6 +33,9 @@ class LabelTest extends TestCase
|
||||
->with('bulkedit', true)
|
||||
->with('count', 0);
|
||||
|
||||
// a simple way to avoid flooding test output with PDF characters.
|
||||
invade($label)->destination = 'S';
|
||||
|
||||
$label->render();
|
||||
|
||||
$this->assertTrue(true, 'Label rendering should not throw an error when location is not set on an asset.');
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user