IdenticalPropertyNamingStrategyTest.php 828 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace JMS\Serializer\Tests\Serializer\Naming;
  3. use JMS\Serializer\Naming\IdenticalPropertyNamingStrategy;
  4. class IdenticalPropertyNamingStrategyTest extends \PHPUnit_Framework_TestCase
  5. {
  6. public function providePropertyNames()
  7. {
  8. return array(
  9. array('createdAt'),
  10. array('my_field'),
  11. array('identical')
  12. );
  13. }
  14. /**
  15. * @dataProvider providePropertyNames
  16. */
  17. public function testTranslateName($propertyName)
  18. {
  19. $mockProperty = $this->getMockBuilder('JMS\Serializer\Metadata\PropertyMetadata')->disableOriginalConstructor()->getMock();
  20. $mockProperty->name = $propertyName;
  21. $strategy = new IdenticalPropertyNamingStrategy();
  22. $this->assertEquals($propertyName, $strategy->translateName($mockProperty));
  23. }
  24. }