diff --git a/Tests/ActiveThemeTest.php b/Tests/ActiveThemeTest.php index aacfd0e..9410021 100644 --- a/Tests/ActiveThemeTest.php +++ b/Tests/ActiveThemeTest.php @@ -22,7 +22,7 @@ class ActiveThemeTest extends \PHPUnit_Framework_TestCase */ public function testGetName() { - $theme = new ActiveTheme("foo", array("foo"), new DeviceDetection()); + $theme = new ActiveTheme("foo", array("foo")); $this->assertEquals("foo", $theme->getName()); } @@ -53,7 +53,7 @@ public function testDevicePhone() */ public function testConstructInvalidName() { - $theme = new ActiveTheme("foo", array("bar"), new DeviceDetection()); + $theme = new ActiveTheme("foo", array("bar")); } /** @@ -62,7 +62,7 @@ public function testConstructInvalidName() */ public function testSetInvalidName() { - $theme = new ActiveTheme("foo", array("foo"), new DeviceDetection()); + $theme = new ActiveTheme("foo", array("foo")); $theme->setName("bar"); } } diff --git a/Tests/EventListener/ThemeRequestListenerTest.php b/Tests/EventListener/ThemeRequestListenerTest.php index a0c07aa..8c67d20 100644 --- a/Tests/EventListener/ThemeRequestListenerTest.php +++ b/Tests/EventListener/ThemeRequestListenerTest.php @@ -11,7 +11,6 @@ */ namespace Liip\Tests\EventListener; -use Liip\ThemeBundle\Helper\DeviceDetection; use Symfony\Component\HttpKernel\HttpKernelInterface; use Liip\ThemeBundle\EventListener\ThemeRequestListener; @@ -29,7 +28,7 @@ class ThemeRequestListenerTest extends \PHPUnit_Framework_TestCase protected function getActiveThemeStub() { $activeTheme = $this->getMockBuilder('Liip\ThemeBundle\ActiveTheme') - ->setConstructorArgs(array('desktop', array('desktop', 'tablet', 'mobile'), new DeviceDetection())) + ->setConstructorArgs(array('desktop', array('desktop', 'tablet', 'mobile'))) ->getMock(); $activeTheme->expects($this->any()) ->method('getThemes') diff --git a/Tests/Locator/FileLocatorTest.php b/Tests/Locator/FileLocatorTest.php index 35c850d..25882e4 100644 --- a/Tests/Locator/FileLocatorTest.php +++ b/Tests/Locator/FileLocatorTest.php @@ -11,7 +11,6 @@ namespace Liip\Tests\Locator; -use Liip\ThemeBundle\Helper\DeviceDetection; use Liip\ThemeBundle\Locator\FileLocator; use Liip\ThemeBundle\ActiveTheme; @@ -65,7 +64,7 @@ protected function getFixturePath() public function testConstructor() { $kernel = $this->getKernelMock(); - $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar')); new FileLocator($kernel, $activeTheme, $this->getFixturePath() . '/rootdir/Resources'); } @@ -75,7 +74,7 @@ public function testConstructor() public function testConstructorFallbackPathMerge() { $kernel = $this->getKernelMock(); - $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar')); $property = new \ReflectionProperty('Liip\ThemeBundle\Locator\FileLocator', 'pathPatterns'); $property->setAccessible(true); @@ -150,7 +149,7 @@ public function testConstructorFallbackPathMerge() public function testLocate() { $kernel = $this->getKernelMock(); - $activeTheme = new ActiveTheme('foo', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('foo', array('foo', 'bar', 'foobar')); $fileLocator = new FileLocator($kernel, $activeTheme, $this->getFixturePath() . '/rootdir/Resources'); $file = $fileLocator->locate('@ThemeBundle/Resources/views/template', $this->getFixturePath(), true); @@ -164,7 +163,7 @@ public function testLocate() public function testLocateWithOverriddenPathPattern() { $kernel = $this->getKernelMock(); - $activeTheme = new ActiveTheme('foo', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('foo', array('foo', 'bar', 'foobar')); $pathPatterns = array( 'bundle_resource' => array( @@ -178,7 +177,7 @@ public function testLocateWithOverriddenPathPattern() $this->assertEquals($this->getFixturePath().'/Resources/views/themes/foo/template', $file); // Fall through user-configured cascade order - /Resources/views/themes/bar will not be found. - $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar')); $fileLocator = new FileLocator($kernel, $activeTheme, $this->getFixturePath() . '/rootdir/Resources', array(), $pathPatterns); @@ -193,7 +192,7 @@ public function testLocateWithOverriddenPathPattern() public function testLocateAppThemeOverridesAll() { $kernel = $this->getKernelMock(); - $activeTheme = new ActiveTheme('foo', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('foo', array('foo', 'bar', 'foobar')); $fileLocator = new FileLocator($kernel, $activeTheme, $this->getFixturePath() . '/rootdir/Resources'); $file = $fileLocator->locate('@ThemeBundle/Resources/views/foo', $this->getFixturePath(), true); @@ -207,7 +206,7 @@ public function testLocateAppThemeOverridesAll() public function testLocateApp() { $kernel = $this->getKernelMock(); - $activeTheme = new ActiveTheme('foo', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('foo', array('foo', 'bar', 'foobar')); $fileLocator = new FileLocator($kernel, $activeTheme, $this->getFixturePath() . '/rootdir/Resources'); $file = $fileLocator->locate('views/template2', $this->getFixturePath().'/rootdir', true); @@ -220,7 +219,7 @@ public function testLocateApp() public function testLocateActiveThemeUpdate() { $kernel = $this->getKernelMock(); - $activeTheme = new ActiveTheme('foo', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('foo', array('foo', 'bar', 'foobar')); $fileLocator = new FileLocatorFake($kernel, $activeTheme, $this->getFixturePath() . '/rootdir/Resources'); $this->assertEquals('foo', $fileLocator->lastTheme); @@ -235,7 +234,7 @@ public function testLocateActiveThemeUpdate() public function testLocateActiveDeviceTypeUpdate() { $kernel = $this->getKernelMock(); - $activeTheme = new ActiveTheme('foo', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('foo', array('foo', 'bar', 'foobar')); $fileLocator = new FileLocatorFake($kernel, $activeTheme, $this->getFixturePath() . '/rootdir/Resources'); $this->assertEquals('foo', $fileLocator->lastTheme); @@ -254,7 +253,7 @@ public function testLocateActiveDeviceTypeUpdate() public function testLocateViewFallback() { $kernel = $this->getKernelMock(); - $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar')); $fileLocator = new FileLocator($kernel, $activeTheme, $this->getFixturePath() . '/rootdir/Resources'); $file = $fileLocator->locate('@ThemeBundle/Resources/views/defaultTemplate', $this->getFixturePath(), true); @@ -268,7 +267,7 @@ public function testLocateViewFallback() public function testLocateAllFiles() { $kernel = $this->getKernelMock(); - $activeTheme = new ActiveTheme('foobar', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('foobar', array('foo', 'bar', 'foobar')); $fileLocator = new FileLocator($kernel, $activeTheme, $this->getFixturePath() . '/rootdir/Resources'); $expectedFiles = array( @@ -287,7 +286,7 @@ public function testLocateAllFiles() public function testLocateAllFilesApp() { $kernel = $this->getKernelMock(); - $activeTheme = new ActiveTheme('foo', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('foo', array('foo', 'bar', 'foobar')); $fileLocator = new FileLocator($kernel, $activeTheme, $this->getFixturePath() . '/rootdir/Resources'); $expectedFiles = array( @@ -305,7 +304,7 @@ public function testLocateAllFilesApp() public function testLocateParentDelegation() { $kernel = $this->getKernelMock(); - $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar')); $fileLocator = new FileLocator($kernel, $activeTheme, $this->getFixturePath() . '/rootdir/Resources'); $file = $fileLocator->locate('Resources/themes/foo/template', $this->getFixturePath(), true); @@ -319,7 +318,7 @@ public function testLocateParentDelegation() public function testLocateRootDirectory() { $kernel = $this->getKernelMock(); - $activeTheme = new ActiveTheme('foo', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('foo', array('foo', 'bar', 'foobar')); $fileLocator = new FileLocator($kernel, $activeTheme, $this->getFixturePath() . '/rootdir/Resources'); $file = $fileLocator->locate('@ThemeBundle/Resources/views/rootTemplate', $this->getFixturePath(), true); @@ -333,7 +332,7 @@ public function testLocateRootDirectory() public function testLocateOverrideDirectory() { $kernel = $this->getKernelMock(); - $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar')); $fileLocator = new FileLocator($kernel, $activeTheme, $this->getFixturePath() . '/rootdir/Resources'); $file = $fileLocator->locate('@ThemeBundle/Resources/views/override', $this->getFixturePath(), true); @@ -348,7 +347,7 @@ public function testLocateOverrideDirectory() public function testLocateInvalidCharacter() { $kernel = $this->getKernelMock(); - $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar')); $fileLocator = new FileLocator($kernel, $activeTheme, $this->getFixturePath() . '/rootdir/Resources'); $file = $fileLocator->locate('@ThemeBundle/Resources/../views/template', $this->getFixturePath(), true); @@ -362,7 +361,7 @@ public function testLocateInvalidCharacter() public function testLocateNoResource() { $kernel = $this->getKernelMock(); - $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar')); $fileLocator = new FileLocator($kernel, $activeTheme, $this->getFixturePath() . '/rootdir/Resources'); $file = $fileLocator->locate('@ThemeBundle/bogus', $this->getFixturePath(), true); @@ -376,7 +375,7 @@ public function testLocateNoResource() public function testLocateNotFound() { $kernel = $this->getKernelMock(); - $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar')); $fileLocator = new FileLocator($kernel, $activeTheme, $this->getFixturePath() . '/rootdir/Resources'); $file = $fileLocator->locate('@ThemeBundle/Resources/nonExistant', $this->getFixturePath(), true); @@ -390,7 +389,7 @@ public function testLocateNotFound() public function testLocateBundleInheritance() { $kernel = $this->getKernelMock(true); - $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar'), new DeviceDetection()); + $activeTheme = new ActiveTheme('bar', array('foo', 'bar', 'foobar')); $fileLocator = $this->getMock( 'Liip\ThemeBundle\Locator\FileLocator', diff --git a/Tests/UseCaseTest.php b/Tests/UseCaseTest.php index fe563bb..c88f0c9 100644 --- a/Tests/UseCaseTest.php +++ b/Tests/UseCaseTest.php @@ -11,7 +11,6 @@ */ namespace Liip\Tests\EventListener; -use Liip\ThemeBundle\Helper\DeviceDetection; use Symfony\Component\HttpKernel\HttpKernelInterface; use Liip\ThemeBundle\EventListener\ThemeRequestListener; @@ -122,7 +121,7 @@ private function assertCookieValue($response, $cookieValue) */ public function testThemeAction($config, $assertion, $hasAlreadyACookie = true) { - $activeTheme = new ActiveTheme($config['active_theme'], $config['themes'], new DeviceDetection()); + $activeTheme = new ActiveTheme($config['active_theme'], $config['themes']); $device = null; if ($config['autodetect_theme']) {