From 5225a1123eced11f439e8b09fcb74d4d5a6dfffb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Attali?= Date: Tue, 16 Jan 2024 21:41:48 +0100 Subject: [PATCH] Fix tests --- .../DataCollector/DeviceDataCollectorTest.php | 20 +++--- .../RequestResponseListenerTest.php | 16 ++--- tests/Helper/DeviceViewTest.php | 64 +++++++++---------- .../Extension/MobileDetectExtensionTest.php | 24 +++---- 4 files changed, 62 insertions(+), 62 deletions(-) diff --git a/tests/DataCollector/DeviceDataCollectorTest.php b/tests/DataCollector/DeviceDataCollectorTest.php index 88d3f8f..d2d841c 100644 --- a/tests/DataCollector/DeviceDataCollectorTest.php +++ b/tests/DataCollector/DeviceDataCollectorTest.php @@ -18,7 +18,7 @@ use MobileDetectBundle\Helper\DeviceView; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\ParameterBag; +use Symfony\Component\HttpFoundation\InputBag; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; @@ -53,8 +53,8 @@ protected function setUp(): void parent::setUp(); $this->request = $this->getMockBuilder(Request::class)->getMock(); - $this->request->query = new ParameterBag(); - $this->request->cookies = new ParameterBag(); + $this->request->query = new InputBag(); + $this->request->cookies = new InputBag(); $this->request->server = new ServerBag(); $this->request->expects(self::any())->method('duplicate')->willReturn($this->request); @@ -75,7 +75,7 @@ public function testCollectCurrentViewMobileIsCurrent(): void 'status_code' => Response::HTTP_FOUND, 'action' => RequestResponseListener::REDIRECT, ]; - $this->request->cookies = new ParameterBag([DeviceView::COOKIE_KEY_DEFAULT => DeviceView::VIEW_MOBILE]); + $this->request->cookies = new InputBag([DeviceView::COOKIE_KEY_DEFAULT => DeviceView::VIEW_MOBILE]); $deviceView = new DeviceView($this->requestStack); $deviceDataCollector = new DeviceDataCollector($deviceView); $deviceDataCollector->setRedirectConfig($redirectConfig); @@ -109,7 +109,7 @@ public function testCollectCurrentViewMobileCanUseTablet(): void 'status_code' => Response::HTTP_FOUND, 'action' => RequestResponseListener::REDIRECT, ]; - $this->request->query = new ParameterBag(['param1' => 'value1']); + $this->request->query = new InputBag(['param1' => 'value1']); $this->request->expects(self::any())->method('getSchemeAndHttpHost')->willReturn('http://t.testsite.com'); $this->request->expects(self::any())->method('getBaseUrl')->willReturn('/base-url'); $this->request->expects(self::any())->method('getPathInfo')->willReturn('/path-info'); @@ -126,7 +126,7 @@ public function testCollectCurrentViewMobileCanUseTablet(): void return $test->request->getSchemeAndHttpHost().$test->request->getBaseUrl().$test->request->getPathInfo().$qs; }); - $this->request->cookies = new ParameterBag([DeviceView::COOKIE_KEY_DEFAULT => DeviceView::VIEW_MOBILE]); + $this->request->cookies = new InputBag([DeviceView::COOKIE_KEY_DEFAULT => DeviceView::VIEW_MOBILE]); $deviceView = new DeviceView($this->requestStack); $deviceDataCollector = new DeviceDataCollector($deviceView); $deviceDataCollector->setRedirectConfig($redirectConfig); @@ -172,7 +172,7 @@ public function testCollectCurrentViewFullCanUseMobile(): void 'status_code' => Response::HTTP_FOUND, 'action' => RequestResponseListener::REDIRECT, ]; - $this->request->query = new ParameterBag(['param1' => 'value1']); + $this->request->query = new InputBag(['param1' => 'value1']); $this->request->expects(self::any())->method('getSchemeAndHttpHost')->willReturn('http://t.testsite.com'); $this->request->expects(self::any())->method('getBaseUrl')->willReturn('/base-url'); $this->request->expects(self::any())->method('getPathInfo')->willReturn('/path-info'); @@ -189,7 +189,7 @@ public function testCollectCurrentViewFullCanUseMobile(): void return $test->request->getSchemeAndHttpHost().$test->request->getBaseUrl().$test->request->getPathInfo().$qs; }); - $this->request->cookies = new ParameterBag([DeviceView::COOKIE_KEY_DEFAULT => DeviceView::VIEW_FULL]); + $this->request->cookies = new InputBag([DeviceView::COOKIE_KEY_DEFAULT => DeviceView::VIEW_FULL]); $deviceView = new DeviceView($this->requestStack); $deviceDataCollector = new DeviceDataCollector($deviceView); $deviceDataCollector->setRedirectConfig($redirectConfig); @@ -235,7 +235,7 @@ public function testCollectCurrentViewFullCantUseMobile(): void 'status_code' => Response::HTTP_FOUND, 'action' => RequestResponseListener::REDIRECT, ]; - $this->request->query = new ParameterBag(['param1' => 'value1']); + $this->request->query = new InputBag(['param1' => 'value1']); $this->request->expects(self::any())->method('getSchemeAndHttpHost')->willReturn('http://testsite.com'); $this->request->expects(self::any())->method('getBaseUrl')->willReturn('/base-url'); $this->request->expects(self::any())->method('getPathInfo')->willReturn('/path-info'); @@ -252,7 +252,7 @@ public function testCollectCurrentViewFullCantUseMobile(): void return $test->request->getSchemeAndHttpHost().$test->request->getBaseUrl().$test->request->getPathInfo().$qs; }); - $this->request->cookies = new ParameterBag([DeviceView::COOKIE_KEY_DEFAULT => DeviceView::VIEW_FULL]); + $this->request->cookies = new InputBag([DeviceView::COOKIE_KEY_DEFAULT => DeviceView::VIEW_FULL]); $deviceView = new DeviceView($this->requestStack); $deviceDataCollector = new DeviceDataCollector($deviceView); $deviceDataCollector->setRedirectConfig($redirectConfig); diff --git a/tests/EventListener/RequestResponseListenerTest.php b/tests/EventListener/RequestResponseListenerTest.php index 7701fd2..b6d9ed6 100644 --- a/tests/EventListener/RequestResponseListenerTest.php +++ b/tests/EventListener/RequestResponseListenerTest.php @@ -12,7 +12,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Cookie; use Symfony\Component\HttpFoundation\HeaderBag; -use Symfony\Component\HttpFoundation\ParameterBag; +use Symfony\Component\HttpFoundation\InputBag; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; @@ -71,8 +71,8 @@ protected function setUp(): void $this->request->expects(self::any())->method('getSchemeAndHttpHost')->willReturn('http://testhost.com'); $this->request->expects(self::any())->method('get')->willReturn('value'); $this->request->expects(self::any())->method('getUriForPath')->willReturn('/'); - $this->request->query = new ParameterBag(); - $this->request->cookies = new ParameterBag(); + $this->request->query = new InputBag(); + $this->request->cookies = new InputBag(); $this->requestStack = $this->getMockBuilder(RequestStack::class)->disableOriginalConstructor()->getMock(); $this->requestStack->expects(self::any()) @@ -89,7 +89,7 @@ protected function setUp(): void public function testHandleRequestHasSwitchParam(): void { - $this->request->query = new ParameterBag(['myparam' => 'myvalue', $this->switchParam => DeviceView::VIEW_MOBILE]); + $this->request->query = new InputBag(['myparam' => 'myvalue', $this->switchParam => DeviceView::VIEW_MOBILE]); $this->request->expects(self::any())->method('getPathInfo')->willReturn('/'); $deviceView = new DeviceView($this->requestStack); $deviceView->setRedirectConfig([DeviceView::VIEW_MOBILE => ['status_code' => Response::HTTP_FOUND]]); @@ -114,7 +114,7 @@ public function testHandleRequestHasSwitchParam(): void public function testHandleRequestBis(): void { - $this->request->query = new ParameterBag(['myparam' => 'myvalue', $this->switchParam => DeviceView::VIEW_MOBILE]); + $this->request->query = new InputBag(['myparam' => 'myvalue', $this->switchParam => DeviceView::VIEW_MOBILE]); $this->request->expects(self::any())->method('getPathInfo')->willReturn('/'); $deviceView = new DeviceView($this->requestStack); $deviceView->setRedirectConfig([DeviceView::VIEW_MOBILE => ['status_code' => Response::HTTP_FOUND]]); @@ -141,7 +141,7 @@ public function testHandleRequestHasSwitchParamAndQuery(): void { $this->config['mobile'] = ['is_enabled' => true, 'host' => 'http://mobilehost.com']; - $this->request->query = new ParameterBag(['myparam' => 'myvalue', $this->switchParam => DeviceView::VIEW_MOBILE]); + $this->request->query = new InputBag(['myparam' => 'myvalue', $this->switchParam => DeviceView::VIEW_MOBILE]); $this->request->expects(self::any())->method('getPathInfo')->willReturn('/'); $this->request->expects(self::any())->method('get')->willReturn('value'); $this->router->expects(self::exactly(2))->method('getRouteCollection')->willReturn( @@ -241,7 +241,7 @@ public function testHandleRequestHasTabletRedirect(): void { $this->config['tablet'] = ['is_enabled' => true, 'host' => 'http://t.testsite.com', 'status_code' => Response::HTTP_FOUND]; - $this->request->query = new ParameterBag(['some' => 'param']); + $this->request->query = new InputBag(['some' => 'param']); $this->request->expects(self::any())->method('getPathInfo')->willReturn('/some/parameters'); $this->request->expects(self::any())->method('get')->willReturn('value'); $this->router->expects(self::exactly(2))->method('getRouteCollection')->willReturn( @@ -284,7 +284,7 @@ public function testHandleRequestWithDifferentSwitchParamRedirect(): void $switchParam = 'custom_param'; - $this->request->query = new ParameterBag(['some' => 'param']); + $this->request->query = new InputBag(['some' => 'param']); $this->request->expects(self::any())->method('getPathInfo')->willReturn('/some/parameters'); $this->router->expects(self::exactly(2))->method('getRouteCollection')->willReturn( $this->createRouteCollectionWithRouteAndRoutingOption(RequestResponseListener::REDIRECT, 2) diff --git a/tests/Helper/DeviceViewTest.php b/tests/Helper/DeviceViewTest.php index f30821c..f03c28b 100644 --- a/tests/Helper/DeviceViewTest.php +++ b/tests/Helper/DeviceViewTest.php @@ -8,7 +8,7 @@ use MobileDetectBundle\Helper\RedirectResponseWithCookie; use PHPUnit\Framework\TestCase; use Symfony\Component\HttpFoundation\Cookie; -use Symfony\Component\HttpFoundation\ParameterBag; +use Symfony\Component\HttpFoundation\InputBag; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; @@ -42,8 +42,8 @@ protected function setUp(): void $this->request = $this->getMockBuilder(Request::class)->getMock(); $this->request->expects(self::any())->method('getSchemeAndHttpHost')->willReturn('http://testsite.com'); $this->request->expects(self::any())->method('getUriForPath')->willReturn('/'); - $this->request->query = new ParameterBag(); - $this->request->cookies = new ParameterBag(); + $this->request->query = new InputBag(); + $this->request->cookies = new InputBag(); $this->requestStack->expects(self::any()) ->method('getMainRequest') @@ -53,7 +53,7 @@ protected function setUp(): void public function testGetViewTypeMobile(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_MOBILE]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_MOBILE]); $deviceView = new DeviceView($this->requestStack); self::assertSame(DeviceView::VIEW_MOBILE, $deviceView->getViewType()); self::assertSame(DeviceView::VIEW_MOBILE, $deviceView->getRequestedViewType()); @@ -61,7 +61,7 @@ public function testGetViewTypeMobile(): void public function testGetViewTypeTablet(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_TABLET]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_TABLET]); $deviceView = new DeviceView($this->requestStack); self::assertSame(DeviceView::VIEW_TABLET, $deviceView->getViewType()); self::assertSame(DeviceView::VIEW_TABLET, $deviceView->getRequestedViewType()); @@ -69,7 +69,7 @@ public function testGetViewTypeTablet(): void public function testGetViewTypeFull(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_FULL]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_FULL]); $deviceView = new DeviceView($this->requestStack); self::assertSame(DeviceView::VIEW_FULL, $deviceView->getViewType()); self::assertSame(DeviceView::VIEW_FULL, $deviceView->getRequestedViewType()); @@ -77,7 +77,7 @@ public function testGetViewTypeFull(): void public function testGetViewTypeNotMobile(): void { - $this->request->query = new ParameterBag(); + $this->request->query = new InputBag(); $deviceView = new DeviceView(); self::assertSame(DeviceView::VIEW_NOT_MOBILE, $deviceView->getViewType()); self::assertNull($deviceView->getRequestedViewType()); @@ -85,7 +85,7 @@ public function testGetViewTypeNotMobile(): void public function testGetViewTypeMobileFromCookie(): void { - $this->request->cookies = new ParameterBag([$this->switchParam => DeviceView::VIEW_MOBILE]); + $this->request->cookies = new InputBag([$this->switchParam => DeviceView::VIEW_MOBILE]); $deviceView = new DeviceView($this->requestStack); self::assertSame(DeviceView::VIEW_MOBILE, $deviceView->getViewType()); self::assertSame(DeviceView::VIEW_MOBILE, $deviceView->getRequestedViewType()); @@ -93,77 +93,77 @@ public function testGetViewTypeMobileFromCookie(): void public function testIsFullViewTrue(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_FULL]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_FULL]); $deviceView = new DeviceView($this->requestStack); self::assertTrue($deviceView->isFullView()); } public function testIsFullViewFalse(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_MOBILE]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_MOBILE]); $deviceView = new DeviceView($this->requestStack); self::assertFalse($deviceView->isFullView()); } public function testIsTabletViewTrue(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_TABLET]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_TABLET]); $deviceView = new DeviceView($this->requestStack); self::assertTrue($deviceView->isTabletView()); } public function testIsTabletViewFalse(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_MOBILE]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_MOBILE]); $deviceView = new DeviceView($this->requestStack); self::assertFalse($deviceView->isTabletView()); } public function testIsMobileViewTrue(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_MOBILE]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_MOBILE]); $deviceView = new DeviceView($this->requestStack); self::assertTrue($deviceView->isMobileView()); } public function testIsMobileViewFalse(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_TABLET]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_TABLET]); $deviceView = new DeviceView($this->requestStack); self::assertFalse($deviceView->isMobileView()); } public function testIsNotMobileViewTrue(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_NOT_MOBILE]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_NOT_MOBILE]); $deviceView = new DeviceView($this->requestStack); self::assertTrue($deviceView->isNotMobileView()); } public function testIsNotMobileViewFalse(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_MOBILE]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_MOBILE]); $deviceView = new DeviceView($this->requestStack); self::assertFalse($deviceView->isNotMobileView()); } public function testHasSwitchParamTrue(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_MOBILE]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_MOBILE]); $deviceView = new DeviceView($this->requestStack); self::assertTrue($deviceView->hasSwitchParam()); } public function testHasSwitchParamFalse1(): void { - $this->request->query = new ParameterBag(); + $this->request->query = new InputBag(); $deviceView = new DeviceView($this->requestStack); self::assertFalse($deviceView->hasSwitchParam()); } public function testHasSwitchParamFalse2(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_MOBILE]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_MOBILE]); $deviceView = new DeviceView(); self::assertFalse($deviceView->hasSwitchParam()); } @@ -212,42 +212,42 @@ public function testSetNotMobileViewAndCheckIsNotMobileView(): void public function testGetSwitchParamValueNull(): void { - $this->request->query = new ParameterBag(); + $this->request->query = new InputBag(); $deviceView = new DeviceView(); self::assertNull($deviceView->getSwitchParamValue()); } public function testGetSwitchParamValueFullDefault(): void { - $this->request->query = new ParameterBag(); + $this->request->query = new InputBag(); $deviceView = new DeviceView($this->requestStack); self::assertSame(DeviceView::VIEW_FULL, $deviceView->getSwitchParamValue()); } public function testGetSwitchParamValueFull(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_FULL]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_FULL]); $deviceView = new DeviceView($this->requestStack); self::assertSame(DeviceView::VIEW_FULL, $deviceView->getSwitchParamValue()); } public function testGetSwitchParamValueMobile(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_MOBILE]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_MOBILE]); $deviceView = new DeviceView($this->requestStack); self::assertSame(DeviceView::VIEW_MOBILE, $deviceView->getSwitchParamValue()); } public function testGetSwitchParamValueTablet(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_TABLET]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_TABLET]); $deviceView = new DeviceView($this->requestStack); self::assertSame(DeviceView::VIEW_TABLET, $deviceView->getSwitchParamValue()); } public function testGetRedirectResponseBySwitchParamWithCookieViewMobile(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_MOBILE]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_MOBILE]); $deviceView = new DeviceView($this->requestStack); $deviceView->setRedirectConfig([DeviceView::VIEW_MOBILE => ['status_code' => Response::HTTP_MOVED_PERMANENTLY]]); $response = $deviceView->getRedirectResponseBySwitchParam('/redirect-url'); @@ -257,7 +257,7 @@ public function testGetRedirectResponseBySwitchParamWithCookieViewMobile(): void public function testGetRedirectResponseBySwitchParamWithCookieViewTablet(): void { - $this->request->query = new ParameterBag([$this->switchParam => DeviceView::VIEW_TABLET]); + $this->request->query = new InputBag([$this->switchParam => DeviceView::VIEW_TABLET]); $deviceView = new DeviceView($this->requestStack); $deviceView->setRedirectConfig([DeviceView::VIEW_TABLET => ['status_code' => Response::HTTP_MOVED_PERMANENTLY]]); $response = $deviceView->getRedirectResponseBySwitchParam('/redirect-url'); @@ -267,7 +267,7 @@ public function testGetRedirectResponseBySwitchParamWithCookieViewTablet(): void public function testGetRedirectResponseBySwitchParamWithCookieViewFullDefault(): void { - $this->request->query = new ParameterBag(); + $this->request->query = new InputBag(); $deviceView = new DeviceView($this->requestStack); $response = $deviceView->getRedirectResponseBySwitchParam('/redirect-url'); self::assertInstanceOf(RedirectResponseWithCookie::class, $response); @@ -276,7 +276,7 @@ public function testGetRedirectResponseBySwitchParamWithCookieViewFullDefault(): public function testModifyResponseToMobileAndCheckResponse(): void { - $this->request->query = new ParameterBag(); + $this->request->query = new InputBag(); $deviceView = new DeviceView($this->requestStack); $response = new Response(); self::assertCount(0, $response->headers->getCookies()); @@ -294,7 +294,7 @@ public function testModifyResponseToMobileAndCheckResponse(): void public function testGetRedirectResponseWithCookieViewMobile(): void { - $this->request->query = new ParameterBag(); + $this->request->query = new InputBag(); $deviceView = new DeviceView($this->requestStack); $response = $deviceView->getRedirectResponse(DeviceView::VIEW_MOBILE, 'http://mobilesite.com', Response::HTTP_FOUND); self::assertInstanceOf(RedirectResponseWithCookie::class, $response); @@ -311,7 +311,7 @@ public function testGetRedirectResponseWithCookieViewMobile(): void public function testGetRedirectResponseAndCheckCookieSettings(): void { - $this->request->query = new ParameterBag(); + $this->request->query = new InputBag(); $deviceView = new DeviceView($this->requestStack); $deviceView->setCookiePath('/test'); $deviceView->setCookieDomain('example.com'); @@ -332,14 +332,14 @@ public function testGetRedirectResponseAndCheckCookieSettings(): void public function testGetCookieKeyDeviceView(): void { - $this->request->query = new ParameterBag(); + $this->request->query = new InputBag(); $deviceView = new DeviceView($this->requestStack); self::assertSame($this->cookieKey, $deviceView->getCookieKey()); } public function testGetSwitchParamDeviceView(): void { - $this->request->query = new ParameterBag(); + $this->request->query = new InputBag(); $deviceView = new DeviceView($this->requestStack); self::assertSame($this->switchParam, $deviceView->getSwitchParam()); } diff --git a/tests/Twig/Extension/MobileDetectExtensionTest.php b/tests/Twig/Extension/MobileDetectExtensionTest.php index f91baf2..41cdbb0 100644 --- a/tests/Twig/Extension/MobileDetectExtensionTest.php +++ b/tests/Twig/Extension/MobileDetectExtensionTest.php @@ -9,7 +9,7 @@ use MobileDetectBundle\Twig\Extension\MobileDetectExtension; use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; -use Symfony\Component\HttpFoundation\ParameterBag; +use Symfony\Component\HttpFoundation\InputBag; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\RequestStack; use Symfony\Component\HttpFoundation\Response; @@ -54,8 +54,8 @@ protected function setUp(): void $this->request = $this->getMockBuilder(Request::class)->getMock(); $this->request->expects(self::any())->method('getSchemeAndHttpHost')->willReturn('http://testsite.com'); $this->request->expects(self::any())->method('getUriForPath')->willReturn('/'); - $this->request->query = new ParameterBag(); - $this->request->cookies = new ParameterBag(); + $this->request->query = new InputBag(); + $this->request->cookies = new InputBag(); $this->requestStack->expects(self::any()) ->method('getMainRequest') @@ -156,7 +156,7 @@ public function testFullViewUrlWithRequestQuery(): void { $this->config['full'] = ['is_enabled' => true, 'host' => 'http://mobilehost.com']; - $this->request->query = new ParameterBag(['myparam' => 'myvalue']); + $this->request->query = new InputBag(['myparam' => 'myvalue']); $deviceView = new DeviceView($this->requestStack); $extension = new MobileDetectExtension($this->requestStack, $this->mobileDetector, $deviceView, $this->config); self::assertSame('http://mobilehost.com?myparam=myvalue', $extension->fullViewUrl()); @@ -166,7 +166,7 @@ public function testFullViewUrlWithRequestOnlyHost(): void { $this->config['full'] = ['is_enabled' => true, 'host' => 'http://mobilehost.com']; - $this->request->query = new ParameterBag(['myparam' => 'myvalue']); + $this->request->query = new InputBag(['myparam' => 'myvalue']); $deviceView = new DeviceView($this->requestStack); $extension = new MobileDetectExtension($this->requestStack, $this->mobileDetector, $deviceView, $this->config); self::assertSame('http://mobilehost.com', $extension->fullViewUrl(false)); @@ -230,7 +230,7 @@ public function testIsDeviceAndroid(): void public function testIsFullViewTrue(): void { - $this->request->cookies = new ParameterBag([$this->switchParam => DeviceView::VIEW_FULL]); + $this->request->cookies = new InputBag([$this->switchParam => DeviceView::VIEW_FULL]); $deviceView = new DeviceView($this->requestStack); $extension = new MobileDetectExtension($this->requestStack, $this->mobileDetector, $deviceView, $this->config); self::assertTrue($extension->isFullView()); @@ -245,7 +245,7 @@ public function testIsFullViewFalse(): void public function testIsMobileViewTrue(): void { - $this->request->cookies = new ParameterBag([$this->switchParam => DeviceView::VIEW_MOBILE]); + $this->request->cookies = new InputBag([$this->switchParam => DeviceView::VIEW_MOBILE]); $deviceView = new DeviceView($this->requestStack); $extension = new MobileDetectExtension($this->requestStack, $this->mobileDetector, $deviceView, $this->config); self::assertTrue($extension->isMobileView()); @@ -253,7 +253,7 @@ public function testIsMobileViewTrue(): void public function testIsMobileViewFalse(): void { - $this->request->cookies = new ParameterBag([$this->switchParam => DeviceView::VIEW_TABLET]); + $this->request->cookies = new InputBag([$this->switchParam => DeviceView::VIEW_TABLET]); $deviceView = new DeviceView($this->requestStack); $extension = new MobileDetectExtension($this->requestStack, $this->mobileDetector, $deviceView, $this->config); self::assertFalse($extension->isMobileView()); @@ -261,7 +261,7 @@ public function testIsMobileViewFalse(): void public function testIsTabletViewTrue(): void { - $this->request->cookies = new ParameterBag([$this->switchParam => DeviceView::VIEW_TABLET]); + $this->request->cookies = new InputBag([$this->switchParam => DeviceView::VIEW_TABLET]); $deviceView = new DeviceView($this->requestStack); $extension = new MobileDetectExtension($this->requestStack, $this->mobileDetector, $deviceView, $this->config); self::assertTrue($extension->isTabletView()); @@ -269,7 +269,7 @@ public function testIsTabletViewTrue(): void public function testIsTabletViewFalse(): void { - $this->request->cookies = new ParameterBag([$this->switchParam => DeviceView::VIEW_MOBILE]); + $this->request->cookies = new InputBag([$this->switchParam => DeviceView::VIEW_MOBILE]); $deviceView = new DeviceView($this->requestStack); $extension = new MobileDetectExtension($this->requestStack, $this->mobileDetector, $deviceView, $this->config); self::assertFalse($extension->isTabletView()); @@ -277,7 +277,7 @@ public function testIsTabletViewFalse(): void public function testIsNotMobileViewTrue(): void { - $this->request->cookies = new ParameterBag([$this->switchParam => DeviceView::VIEW_NOT_MOBILE]); + $this->request->cookies = new InputBag([$this->switchParam => DeviceView::VIEW_NOT_MOBILE]); $deviceView = new DeviceView($this->requestStack); $extension = new MobileDetectExtension($this->requestStack, $this->mobileDetector, $deviceView, $this->config); self::assertTrue($extension->isNotMobileView()); @@ -285,7 +285,7 @@ public function testIsNotMobileViewTrue(): void public function testIsNotMobileViewFalse(): void { - $this->request->cookies = new ParameterBag([$this->switchParam => DeviceView::VIEW_FULL]); + $this->request->cookies = new InputBag([$this->switchParam => DeviceView::VIEW_FULL]); $deviceView = new DeviceView($this->requestStack); $extension = new MobileDetectExtension($this->requestStack, $this->mobileDetector, $deviceView, $this->config); self::assertFalse($extension->isNotMobileView());