From 38c1d6284f6dba2cb3ecb89d35b77150868fef91 Mon Sep 17 00:00:00 2001 From: Faust Date: Wed, 16 Oct 2024 09:36:05 +0200 Subject: [PATCH 1/2] Version for PHP 8.2 and Symfony 6.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Projekt-Informationen angepasst - Test ergänzt --- README.md | 4 +- composer.json | 10 ++-- .../Extension/MobileDetectExtensionTest.php | 53 ++++++++----------- 3 files changed, 30 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index cdbee8d..895aab0 100644 --- a/README.md +++ b/README.md @@ -3,12 +3,12 @@ MobileDetectBundle ================== -Symfony 3.4.x-6.0.x bundle to detect mobile devices, manage mobile view and redirect to the mobile and tablet version. +Symfony 6.4.x / PHP 8.2 bundle to detect mobile devices, manage mobile view and redirect to the mobile and tablet version. [![Github Actions Status](https://github.com/tattali/MobileDetectBundle/actions/workflows/main.yml/badge.svg?branch=main )](https://github.com/tattali/MobileDetectBundle/actions/workflows/main.yml?query=branch%3Amain) [![Latest Stable Version](http://poser.pugx.org/tattali/mobile-detect-bundle/v)](https://packagist.org/packages/tattali/mobile-detect-bundle) [![Total Downloads](http://poser.pugx.org/tattali/mobile-detect-bundle/downloads)](https://packagist.org/packages/tattali/mobile-detect-bundle) [![codecov](https://codecov.io/gh/tattali/MobileDetectBundle/branch/main/graph/badge.svg?token=HWV1OYRSD9)](https://codecov.io/gh/tattali/MobileDetectBundle) [![License](http://poser.pugx.org/tattali/mobile-detect-bundle/license)](https://packagist.org/packages/tattali/mobile-detect-bundle) [![PHP Version Require](http://poser.pugx.org/tattali/mobile-detect-bundle/require/php)](https://packagist.org/packages/tattali/mobile-detect-bundle) -*This bundle is a fork of [suncat2000/MobileDetectBundle](https://github.com/suncat2000/MobileDetectBundle). As this project doesn't look maintained anymore, we decided to create & maintain a fork. For more information read our [manifest](https://github.com/tattali/MobileDetectBundle/issues/8).* +*This bundle is a fork of [tattali/MobileDetectBundle](https://github.com/tattali/MobileDetectBundle) that is a fork of [suncat2000/MobileDetectBundle](https://github.com/suncat2000/MobileDetectBundle). As this project doesn't look maintained anymore, we decided to create & maintain a fork. For more information read our [manifest](https://github.com/tattali/MobileDetectBundle/issues/8).* Introduction ------------ diff --git a/composer.json b/composer.json index ff65f2e..933c9f2 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { - "name": "tattali/mobile-detect-bundle", - "description": "Symfony 6.4 bundle to detect mobile devices, manage mobile view and redirect to the mobile and tablet version.", + "name": "digifa/mobile-detect-bundle", + "description": "Symfony 6.4 / PHP 8.2 bundle to detect mobile devices, manage mobile view and redirect to the mobile and tablet version.", "keywords": [ "mobile detect", "device detect", @@ -12,10 +12,14 @@ "symfony mobiledetect", "symfony" ], - "homepage": "https://github.com/tattali/MobileDetectBundle", + "homepage": "https://github.com/digifa/MobileDetectBundle", "type": "symfony-bundle", "license": "MIT", "authors": [ + { + "name": "Guido Faust", + "email": "gfaust@digifa.de" + }, { "name": "Théo Attali", "email": "theoattali@gmail.com" diff --git a/tests/Twig/Extension/MobileDetectExtensionTest.php b/tests/Twig/Extension/MobileDetectExtensionTest.php index 5400208..750860b 100644 --- a/tests/Twig/Extension/MobileDetectExtensionTest.php +++ b/tests/Twig/Extension/MobileDetectExtensionTest.php @@ -68,38 +68,6 @@ protected function setUp(): void ]; } - public function testGetFunctionsArray(): void - { - $deviceView = new DeviceView($this->requestStack); - $extension = new MobileDetectExtension($this->requestStack, $this->mobileDetector, $deviceView, $this->config); - - $functions = $extension->getFunctions(); - self::assertCount(13, $functions); - $names = [ - 'is_mobile' => 'isMobile', - 'is_tablet' => 'isTablet', - 'is_device' => 'isDevice', - 'is_full_view' => 'isFullView', - 'is_mobile_view' => 'isMobileView', - 'is_tablet_view' => 'isTabletView', - 'is_not_mobile_view' => 'isNotMobileView', - 'is_ios' => 'isIOS', - 'is_android_os' => 'isAndroidOS', - 'is_windows_os' => 'isWindowsOS', - 'full_view_url' => 'fullViewUrl', - 'device_version' => 'deviceVersion', - 'rules_list' => 'getRules', - ]; - foreach ($functions as $function) { - self::assertInstanceOf(TwigFunction::class, $function); - $name = $function->getName(); - $callable = $function->getCallable(); - self::assertArrayHasKey($name, $names); - self::assertIsArray($callable); - self::assertSame($names[$name], $callable[1]); - } - } - public function testRulesList(): void { $deviceView = new DeviceView($this->requestStack); @@ -368,4 +336,25 @@ public function testIsWindowsOSFalse(): void $extension = new MobileDetectExtension($this->requestStack, $this->mobileDetector, $deviceView, $this->config); self::assertFalse($extension->isWindowsOS()); } + + public function testGetFunctions(): void + { + $deviceView = new DeviceView($this->requestStack); + $extension = new MobileDetectExtension($this->requestStack, $this->mobileDetector, $deviceView, $this->config); + $functions = $extension->getFunctions(); + + self::assertCount(13, $functions); + self::assertInstanceOf(TwigFunction::class, $functions[0]); + self::assertInstanceOf(TwigFunction::class, $functions[1]); + self::assertInstanceOf(TwigFunction::class, $functions[2]); + self::assertInstanceOf(TwigFunction::class, $functions[3]); + self::assertInstanceOf(TwigFunction::class, $functions[4]); + self::assertInstanceOf(TwigFunction::class, $functions[5]); + self::assertInstanceOf(TwigFunction::class, $functions[6]); + self::assertInstanceOf(TwigFunction::class, $functions[7]); + self::assertInstanceOf(TwigFunction::class, $functions[8]); + self::assertInstanceOf(TwigFunction::class, $functions[9]); + self::assertInstanceOf(TwigFunction::class, $functions[10]); + self::assertInstanceOf(TwigFunction::class, $functions[11]); + } } From f20f7404fe6905a0cf67927c68cdf035e215f10b Mon Sep 17 00:00:00 2001 From: Faust Date: Wed, 16 Oct 2024 12:58:22 +0200 Subject: [PATCH 2/2] Version for PHP 8.2 and Symfony 6.4 - Projekt-Informations adjusted - README.md updated - Github workflow adjusted --- .github/workflows/main.yml | 23 +++-------------------- README.md | 6 +++--- src/Resources/doc/legacy-versions.md | 7 ++++++- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6896e78..6d59a1c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,31 +24,14 @@ jobs: fail-fast: false matrix: php: - - 8.0 - - 8.1 + - 8.2 dependencies: - highest stability: - stable symfony-require: - # Test latest LTS - - 5.4.* - # Test last supported version - - 6.0.* - - 6.* - include: - # Tests the lowest set of dependencies - # - symfony-require: 5.4.* - # dependencies: lowest - # stability: stable - # php: 8.0 - - # Bleeding edge - - symfony-require: 6.* - php: 8.1 - dependencies: highest - stability: dev - + # Test latest stable version + - 6.4 steps: - name: Checkout code uses: actions/checkout@v3 diff --git a/README.md b/README.md index 895aab0..692cae0 100644 --- a/README.md +++ b/README.md @@ -5,8 +5,8 @@ MobileDetectBundle Symfony 6.4.x / PHP 8.2 bundle to detect mobile devices, manage mobile view and redirect to the mobile and tablet version. -[![Github Actions Status](https://github.com/tattali/MobileDetectBundle/actions/workflows/main.yml/badge.svg?branch=main -)](https://github.com/tattali/MobileDetectBundle/actions/workflows/main.yml?query=branch%3Amain) [![Latest Stable Version](http://poser.pugx.org/tattali/mobile-detect-bundle/v)](https://packagist.org/packages/tattali/mobile-detect-bundle) [![Total Downloads](http://poser.pugx.org/tattali/mobile-detect-bundle/downloads)](https://packagist.org/packages/tattali/mobile-detect-bundle) [![codecov](https://codecov.io/gh/tattali/MobileDetectBundle/branch/main/graph/badge.svg?token=HWV1OYRSD9)](https://codecov.io/gh/tattali/MobileDetectBundle) [![License](http://poser.pugx.org/tattali/mobile-detect-bundle/license)](https://packagist.org/packages/tattali/mobile-detect-bundle) [![PHP Version Require](http://poser.pugx.org/tattali/mobile-detect-bundle/require/php)](https://packagist.org/packages/tattali/mobile-detect-bundle) +[![Github Actions Status](https://github.com/digifa/MobileDetectBundle/actions/workflows/main.yml/badge.svg?branch=main +)](https://github.com/digifa/MobileDetectBundle/actions/workflows/main.yml?query=branch%3Amain) [![Latest Stable Version](http://poser.pugx.org/digifa/mobile-detect-bundle/v)](https://packagist.org/packages/digifa/mobile-detect-bundle) [![Total Downloads](http://poser.pugx.org/digifa/mobile-detect-bundle/downloads)](https://packagist.org/packages/digifa/mobile-detect-bundle) [![codecov](https://codecov.io/gh/digifa/MobileDetectBundle/branch/main/graph/badge.svg?token=HWV1OYRSD9)](https://codecov.io/gh/digifa/MobileDetectBundle) [![License](http://poser.pugx.org/digifa/mobile-detect-bundle/license)](https://packagist.org/packages/digifa/mobile-detect-bundle) [![PHP Version Require](http://poser.pugx.org/digifa/mobile-detect-bundle/require/php)](https://packagist.org/packages/digifa/mobile-detect-bundle) *This bundle is a fork of [tattali/MobileDetectBundle](https://github.com/tattali/MobileDetectBundle) that is a fork of [suncat2000/MobileDetectBundle](https://github.com/suncat2000/MobileDetectBundle). As this project doesn't look maintained anymore, we decided to create & maintain a fork. For more information read our [manifest](https://github.com/tattali/MobileDetectBundle/issues/8).* @@ -76,4 +76,4 @@ License and credits This bundle is under the MIT license. See the complete [license](src/Resources/meta/LICENSE) in the bundle -Original authors: [suncat2000](https://github.com/suncat2000), [HenriVesala](https://github.com/HenriVesala), [netmikey](https://github.com/netmikey) and [all contributors](https://github.com/suncat2000/MobileDetectBundle/graphs/contributors) +Original authors: [tattali](https://gihub.com/tattali), [suncat2000](https://github.com/suncat2000), [HenriVesala](https://github.com/HenriVesala), [netmikey](https://github.com/netmikey) and [all contributors](https://github.com/suncat2000/MobileDetectBundle/graphs/contributors) diff --git a/src/Resources/doc/legacy-versions.md b/src/Resources/doc/legacy-versions.md index c4c2f5f..8b0a20c 100644 --- a/src/Resources/doc/legacy-versions.md +++ b/src/Resources/doc/legacy-versions.md @@ -3,8 +3,13 @@ Installation Composer -------- +### For Symfony 6.4 & PHP 8.2 -### Latest Symfony >= 5.1 || <= 6.4 +```sh +composer require 'digifa/mobile-detect-bundle:2.3.*-lts' +``` + +### Latest Symfony >= 5.1 || < 6.4 ```sh composer require tattali/mobile-detect-bundle