You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
611 B

3 years ago
  1. <?php
  2. namespace Hamcrest;
  3. use PHPUnit\Framework\TestCase;
  4. class SampleInvokeMatcher extends BaseMatcherTest
  5. {
  6. private $matchAgainst;
  7. public function __construct($matchAgainst)
  8. {
  9. $this->matchAgainst = $matchAgainst;
  10. }
  11. public function matches($item)
  12. {
  13. return $item == $this->matchAgainst;
  14. }
  15. }
  16. class InvokedMatcherTest extends TestCase
  17. {
  18. public function testInvokedMatchersCallMatches()
  19. {
  20. $sampleMatcher = new SampleInvokeMatcher('foo');
  21. $this->assertTrue($sampleMatcher('foo'));
  22. $this->assertFalse($sampleMatcher('bar'));
  23. }
  24. }