Skip to content

Commit

Permalink
Add test and update README
Browse files Browse the repository at this point in the history
  • Loading branch information
mtawil authored and freekmurze committed Jun 28, 2022
1 parent 48eb0ef commit c6b6c6f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ Browsershot also can get the body of an html page after JavaScript has been exec
Browsershot::url('https://example.com')->bodyHtml(); // returns the html of the body
```

If you want to set a custom temp path, you can use the `setCustomTempPath` method:

```php
Browsershot::url('https://example.com')
->setCustomTempPath(storage_path('browsershot'))
->pdf();
```

If you wish to retrieve an array list with all of the requests that the page triggered you can do so:

```php
Expand Down
12 changes: 12 additions & 0 deletions tests/BrowsershotTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1525,3 +1525,15 @@
->and($failedRequests[0]['status'])->toBe(404)
->and($failedRequests[0]['url'])->toBe('https://bitsofco.de/broken.jpg/');
});

it('can set the custom temp path', function () {
$output = Browsershot::url('https://example.com')
->setCustomTempPath(__DIR__.'/temp/')
->pdf();

$finfo = finfo_open();

$mimeType = finfo_buffer($finfo, $output, FILEINFO_MIME_TYPE);

expect('application/pdf')->toEqual($mimeType);
});

0 comments on commit c6b6c6f

Please sign in to comment.