Skip to content

Commit 7ac097c

Browse files
committed
Add method to retrieve path to temp file
1 parent 8876de7 commit 7ac097c

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/Wrapper.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,18 @@ protected function browsershot(): Browsershot
8080
return $this->browsershot;
8181
}
8282

83+
/**
84+
* Gets the temp file path
85+
*
86+
* @return string
87+
*/
88+
public function getTempFilePath(): string
89+
{
90+
$this->generateTempFile();
91+
92+
return $this->tempFile;
93+
}
94+
8395
/**
8496
* Reads the output from the generated temp file
8597
*

tests/FacadePDFTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,14 @@ public function it_generates_different_content_from_the_facades_once_it_has_been
3434

3535
$this->assertNotEquals($googleContent, $githubContent);
3636
}
37+
38+
/** @test */
39+
public function it_returns_the_path_to_the_temp_file()
40+
{
41+
$pdf = PDF::loadView('test');
42+
43+
$path = $pdf->getTempFilePath();
44+
45+
$this->assertFileExists($path);
46+
}
3747
}

0 commit comments

Comments
 (0)