Permalink
Browse files

Added test for FOSRestBundle::getSymfonyVersion and slight refactor

  • Loading branch information...
1 parent 4ca094f commit 114a66730d3e398cd096b0ddc67a52ea55adb5cf Anthony Sterling committed Oct 18, 2012
Showing with 6 additions and 3 deletions.
  1. +1 −3 FOSRestBundle.php
  2. +5 −0 Tests/FOSRestBundleTest.php
View
@@ -39,8 +39,6 @@ public function build(ContainerBuilder $container)
*/
public static function getSymfonyVersion($version)
{
- return implode('.', array_slice(array_map(function($val) {
- return (int) $val;
- }, explode('.', $version)), 0, 3));
+ return implode('.', sscanf($version, '%d.%d.%d'));
}
}
@@ -30,4 +30,9 @@ public function testBuild()
$bundle = new FOSRestBundle();
$bundle->build($container);
}
+
+ public function testGetSymfonyVersion()
+ {
+ $this->assertSame('2.2.0', FOSRestBundle::getSymfonyVersion('2.2.0.DEV'));
+ }
}

0 comments on commit 114a667

Please sign in to comment.