minor #18708 [Asset] added a test for StaticVerionStrategy (danionut90)
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #18708).
Discussion
----------
[Asset] added a test for StaticVerionStrategy
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | N/A
| License | MIT
| Doc PR | N/A
Commits
-------
80300f5
added StaticVerionStrategyTest
This commit is contained in:
commit
921f615a43
@ -0,0 +1,43 @@
|
|||||||
|
<?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\Asset\Tests\VersionStrategy;
|
||||||
|
|
||||||
|
use Symfony\Component\Asset\VersionStrategy\StaticVersionStrategy;
|
||||||
|
|
||||||
|
class StaticVersionStrategyTest extends \PHPUnit_Framework_TestCase
|
||||||
|
{
|
||||||
|
public function testGetVersion()
|
||||||
|
{
|
||||||
|
$version = 'v1';
|
||||||
|
$path = 'test-path';
|
||||||
|
$staticVersionStrategy = new StaticVersionStrategy($version);
|
||||||
|
$this->assertEquals($version, $staticVersionStrategy->getVersion($path));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getConfigs
|
||||||
|
*/
|
||||||
|
public function testApplyVersion($path, $version, $format)
|
||||||
|
{
|
||||||
|
$staticVersionStrategy = new StaticVersionStrategy($version, $format);
|
||||||
|
$formatted = sprintf($format ?: '%s?%s', $path, $version);
|
||||||
|
$this->assertEquals($formatted, $staticVersionStrategy->applyVersion($path));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getConfigs()
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
array('test-path', 'v1', null),
|
||||||
|
array('test-path', 'v2', '%s?test%s'),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user