From 80300f52d485c6e77dcc675c20b2ad42838a5d86 Mon Sep 17 00:00:00 2001 From: danionut90 Date: Wed, 4 May 2016 22:31:11 +0300 Subject: [PATCH] added StaticVerionStrategyTest --- .../StaticVersionStrategyTest.php | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/Symfony/Component/Asset/Tests/VersionStrategy/StaticVersionStrategyTest.php diff --git a/src/Symfony/Component/Asset/Tests/VersionStrategy/StaticVersionStrategyTest.php b/src/Symfony/Component/Asset/Tests/VersionStrategy/StaticVersionStrategyTest.php new file mode 100644 index 0000000000..77958ce2ca --- /dev/null +++ b/src/Symfony/Component/Asset/Tests/VersionStrategy/StaticVersionStrategyTest.php @@ -0,0 +1,43 @@ + + * + * 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'), + ); + } +}