1<?php 2 3declare(strict_types=1); 4 5namespace JMS\Serializer\Tests\Serializer\Naming; 6 7use JMS\Serializer\Naming\CamelCaseNamingStrategy; 8use PHPUnit\Framework\TestCase; 9 10class CamelCaseNamingStrategyTest extends TestCase 11{ 12 public function providePropertyNames() 13 { 14 return [ 15 ['getUrl', 'get_url'], 16 ['getURL', 'get_url'], 17 ]; 18 } 19 20 /** 21 * @dataProvider providePropertyNames 22 */ 23 public function testCamelCaseNamingHandlesMultipleUppercaseLetters($propertyName, $expected) 24 { 25 $mockProperty = $this->getMockBuilder('JMS\Serializer\Metadata\PropertyMetadata')->disableOriginalConstructor()->getMock(); 26 $mockProperty->name = $propertyName; 27 28 $strategy = new CamelCaseNamingStrategy(); 29 self::assertEquals($expected, $strategy->translateName($mockProperty)); 30 } 31} 32