Nessuna descrizione

InvokedMatcherTest.php 611B

1234567891011121314151617181920212223242526272829303132
  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. }