PropertyNameMatcherTest.php 703 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace DeepCopyTest\Matcher;
  3. use DeepCopy\Matcher\PropertyNameMatcher;
  4. use PHPUnit\Framework\TestCase;
  5. use stdClass;
  6. /**
  7. * @covers \DeepCopy\Matcher\PropertyNameMatcher
  8. */
  9. class PropertyNameMatcherTest extends TestCase
  10. {
  11. /**
  12. * @dataProvider providePairs
  13. */
  14. public function test_it_matches_the_given_property($object, $prop, $expected)
  15. {
  16. $matcher = new PropertyNameMatcher('foo');
  17. $actual = $matcher->matches($object, $prop);
  18. $this->assertEquals($expected, $actual);
  19. }
  20. public function providePairs()
  21. {
  22. return [
  23. [new stdClass(), 'foo', true],
  24. [new stdClass(), 'unknown', false],
  25. ];
  26. }
  27. }