Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Validator] Fix array notation in the PropertyPath::append()
- Loading branch information
Showing
2 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
src/Symfony/Component/Validator/Tests/Util/PropertyPathTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\Validator\Tests\Util; | ||
|
||
use Symfony\Component\Validator\Util\PropertyPath; | ||
|
||
class PropertyPathTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @dataProvider provideAppendPaths | ||
*/ | ||
public function testAppend($basePath, $subPath, $expectedPath, $message) | ||
{ | ||
$this->assertSame($expectedPath, PropertyPath::append($basePath, $subPath), $message); | ||
} | ||
|
||
public function provideAppendPaths() | ||
{ | ||
return array( | ||
array('foo', '', 'foo', 'It returns the basePath if subPath is empty'), | ||
array('', 'bar', 'bar', 'It returns the subPath if basePath is empty'), | ||
array('foo', 'bar', 'foo.bar', 'It append the subPath to the basePath'), | ||
array('foo', '[bar]', 'foo[bar]', 'It does not include the dot separator if subPath uses the array notation') | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters