@@ -483,8 +483,25 @@ final class FileCreatedExpectation implements Expectation
483483}
484484```
485485
486- Now, to be able to use this method, include the trait ` PHPUnitExtras\Expectation\Expectations ` in your test case class,
487- or inherit it from ` PHPUnitExtras\TestCase ` , where this trait is already included.
486+ Now, to be able to use this expectation, inherit your test case class from ` PHPUnitExtras\TestCase `
487+ (recommended) or include the ` PHPUnitExtras\Expectation\Expectations ` trait:
488+
489+ ``` php
490+ use PHPUnit\Framework\TestCase;
491+ use PHPUnitExtras\Expectation\Expectations;
492+
493+ final class MyTest extends TestCase
494+ {
495+ use Expectations;
496+
497+ protected function tearDown() : void
498+ {
499+ $this->verifyExpectations();
500+ }
501+
502+ // ...
503+ }
504+ ```
488505After that, call your expectation as shown below:
489506
490507``` php
@@ -497,7 +514,7 @@ public function testDumpPdfToFile() : void
497514}
498515```
499516
500- For convenience, you can put this statement in a separate method or even group your expectations into a trait:
517+ For convenience, you can put this statement in a separate method and group your expectations into a trait:
501518
502519``` php
503520namespace App\Tests\PhpUnit;
@@ -511,6 +528,8 @@ trait FileExpectations
511528 $this->expect(new FileCreatedExpectation($filename));
512529 }
513530
531+ // ...
532+
514533 abstract protected function expect(Expectation $expectation) : void;
515534}
516535```
0 commit comments