Skip to content

Commit

Permalink
update documentation including testing (#364)
Browse files Browse the repository at this point in the history
* update documentation including testing

* readme improvement
  • Loading branch information
denissonleal authored and barryvdh committed Oct 10, 2019
1 parent 9a827c9 commit 17ce957
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,46 @@ If you need the output as a string, you can get the rendered PDF with the output

See the [wkhtmltopdf manual](http://wkhtmltopdf.org/usage/wkhtmltopdf.txt) for more information/settings.

### Testing - PDF fake

As an alternative to mocking, you may use the `PDF` facade's `fake` method. When using fakes, assertions are made after the code under test is executed:

```php
<?php

namespace Tests\Feature;

use Tests\TestCase;
use PDF;

class ExampleTest extends TestCase
{
public function testPrintOrderShipping()
{
PDF::fake();

// Perform order shipping...

PDF::assertViewIs('view-pdf-order-shipping');
PDF::assertSee('Name');
}
}
```

#### Other available assertions:

```php
PDF::assertViewIs($value);
PDF::assertViewHas($key, $value = null);
PDF::assertViewHasAll(array $bindings);
PDF::assertViewMissing($key);
PDF::assertSee($value);
PDF::assertSeeText($value);
PDF::assertDontSee($value);
PDF::assertDontSeeText($value);
PDF::assertFileNameIs($value);
```

### License

This Snappy Wrapper for Laravel is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

0 comments on commit 17ce957

Please sign in to comment.