Skip to content

Commit 80300f5

Browse files
danionut90fabpot
authored andcommitted
added StaticVerionStrategyTest
1 parent 215c891 commit 80300f5

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\Asset\Tests\VersionStrategy;
13+
14+
use Symfony\Component\Asset\VersionStrategy\StaticVersionStrategy;
15+
16+
class StaticVersionStrategyTest extends \PHPUnit_Framework_TestCase
17+
{
18+
public function testGetVersion()
19+
{
20+
$version = 'v1';
21+
$path = 'test-path';
22+
$staticVersionStrategy = new StaticVersionStrategy($version);
23+
$this->assertEquals($version, $staticVersionStrategy->getVersion($path));
24+
}
25+
26+
/**
27+
* @dataProvider getConfigs
28+
*/
29+
public function testApplyVersion($path, $version, $format)
30+
{
31+
$staticVersionStrategy = new StaticVersionStrategy($version, $format);
32+
$formatted = sprintf($format ?: '%s?%s', $path, $version);
33+
$this->assertEquals($formatted, $staticVersionStrategy->applyVersion($path));
34+
}
35+
36+
public function getConfigs()
37+
{
38+
return array(
39+
array('test-path', 'v1', null),
40+
array('test-path', 'v2', '%s?test%s'),
41+
);
42+
}
43+
}

0 commit comments

Comments
 (0)