Skip to content

Commit

Permalink
Upgrad tests, remove unsupported php versions, add php 8.1 as minimum…
Browse files Browse the repository at this point in the history
… for the next major release
  • Loading branch information
hisorange committed Mar 28, 2023
1 parent 80796f5 commit 08a3bd3
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 211 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
strategy:
fail-fast: true
matrix:
php-version: [8.1]
laravel-version: [9.39.0]
php-version: [8.2]
laravel-version: [10.5.0]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@master
Expand Down Expand Up @@ -47,8 +47,8 @@ jobs:
- name: Run test suites
run: composer run-script test

- name: Analyze
run: vendor/bin/phpstan analyse -c phpstan.neon ./src/
# - name: Analyze
# run: vendor/bin/phpstan analyse -c phpstan.neon ./src/

# - name: phpcs
# run: php vendor/bin/phpcs --standard=PSR12 ./src/
Expand Down
79 changes: 0 additions & 79 deletions .github/workflows/test-php7.yml

This file was deleted.

21 changes: 9 additions & 12 deletions .github/workflows/test-php8.1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,16 @@ jobs:
# these versions supports php8 in their composer.json
laravel-version:
[
9.0,
9.1,
9.2,
9.3,
9.4,
9.5,
9.6,
9.7,
9.8,
9.52,
10.0,
10.1,
10.2,
10.3,
10.4,
]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup PHP
uses: shivammathur/setup-php@master
Expand All @@ -47,8 +44,8 @@ jobs:
- name: Run test suites
run: composer run-script test

- name: Analyze
run: vendor/bin/phpstan analyse -c phpstan.neon ./src/
# - name: Analyze
# run: vendor/bin/phpstan analyse -c phpstan.neon ./src/

# - name: phpcs
# run: php vendor/bin/phpcs --standard=PSR12 ./src/
65 changes: 0 additions & 65 deletions .github/workflows/test-php8.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ vendor
.vscode
demo/cache
.phpunit.result.cache
.DS_store
.DS_store
.phpunit.cache
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- Support for Laravel 10.x
- Upgrade to MobileDetect 3.x
- Remove the outdated "mobileGrade" feature
- Test on PHP 8.2 too

### Changes in 4.5.2

Expand Down
1 change: 0 additions & 1 deletion Procfile

This file was deleted.

44 changes: 17 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Browser Detection Logo](https://user-images.githubusercontent.com/3441017/126362397-d9767164-4f44-4d41-a3cd-b669e10e95dc.png)

## Browser Detection v4.5 by _[hisorange](https://hisorange.me)_
## Browser Detection v5.0 by _[hisorange](https://hisorange.me)_

[![Latest Stable Version](https://poser.pugx.org/hisorange/browser-detect/v/stable)](https://packagist.org/packages/hisorange/browser-detect)
[![Build](https://github.com/hisorange/browser-detect/actions/workflows/latest.yml/badge.svg?branch=stable)](https://github.com/hisorange/browser-detect/actions/workflows/latest.yml)
Expand All @@ -10,7 +10,7 @@

Easy to use package to identify the visitor's browser details and device type.
Magic is **not** involved the results are generated by multiple well tested and developed packages.
Supporting **every laravel** version between **4.0 » 9.0**, also tested on **every PHP** version between **5.6 » 8.1**.
Supports **every Laravel** version between **4.0 » 10.x**, also tested on **every PHP** version between **5.6 » 8.2**.

### How to install

Expand All @@ -32,10 +32,14 @@ In Your code just call the **Browser** facade:
use Browser;

// Determine the user's device type is simple as this:
Browser::isMobile();
$isMobile = Browser::isMobile();
Browser::isTablet();
Browser::isDesktop();

if (Browser::isMobile()) {
// Redirect to the mobile version of the site.
}

// Every wondered if it is a bot who loading Your page?
if (Browser::isBot()) {
echo 'No need to wonder anymore!';
Expand Down Expand Up @@ -85,15 +89,16 @@ Easy peasy, ain't it?

The following matrix is has been continuously tested by the great and awesome **GitHub Actions**!

| ----- | Browser Detect 1.x | Browser Detect 2.x | Browser Detect 3.x | Browser Detect 4.x |
| :---------: | :----------------: | :----------------: | :----------------: | :----------------: |
| Laravel 4.x | ✓ | ✓ | - | - |
| Laravel 5.x | - | ✓ | ✓ | - |
| Laravel 6.x | - | - | - | ✓ |
| Laravel 7.x | - | - | - | ✓ |
| Laravel 8.x | - | - | - | 4.4+ |
| Laravel 9.x | - | - | - | 4.4+ |
| Standalone | - | - | - | 4.2+ |
| ----- | Browser Detect 1.x | Browser Detect 2.x | Browser Detect 3.x | Browser Detect 4.x | Browser Detect 5.x |
| :----------: | :----------------: | :----------------: | :----------------: | :----------------: | :----------------: |
| Laravel 4.x | ✓ | ✓ | - | - | - |
| Laravel 5.x | - | ✓ | ✓ | - | - |
| Laravel 6.x | - | - | - | ✓ | - |
| Laravel 7.x | - | - | - | ✓ | - |
| Laravel 8.x | - | - | - | 4.4+ | - |
| Laravel 9.x | - | - | - | 4.4+ | ✓ |
| Laravel 10.x | - | - | - | - | ✓ |
| Standalone | - | - | - | 4.2+ | ✓ |

Since 2013 the package runs tests on every possible PHP / Laravel version matrix.

Expand Down Expand Up @@ -210,21 +215,6 @@ And it will use the application's cache to persist the result for a week or so,
this should provide You with a sufficient caching mechanism so the detection will
cost less than **0.02 millisecond**, this was tested with an 80,000 fake visit.

### Community

---

At the time of this writing, the library is getting closer to be 7 years old. I have implemented
every user request which was feasible, and running out of ideas for the future. By this statement
I am declaring this as the last feature release at version 4.2, from now on I will maintain compatibility
with new Laravel and PHP versions, but not planning to do any new features.

Thank You for your support over the years, and worry not, the library is stable, and has all the features You ever need.

~ Update on this :D

No major features are added in the past months, but with the help of [Raymund Ács](https://github.com/PoOwAa) we are patching and continuing the support for micro features and version ports.

### Changelog

---
Expand Down
22 changes: 11 additions & 11 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false" bootstrap="./vendor/autoload.php" verbose="true" colors="true">
<testsuite name="Browser Detect PHPUnit Tests">
<directory suffix="Test.php">./tests</directory>
<exclude>./tests/_fixture</exclude>
</testsuite>
<filter>
<whitelist addUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</phpunit>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="./vendor/autoload.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd" cacheDirectory=".phpunit.cache">
<coverage includeUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<testsuite name="Browser Detect PHPUnit Tests">
<directory suffix="Test.php">./tests</directory>
<exclude>./tests/_fixture</exclude>
</testsuite>
</phpunit>
5 changes: 3 additions & 2 deletions tests/BladeTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

namespace hisorange\BrowserDetect\Test;

use Illuminate\Support\Facades\Blade;
Expand All @@ -14,7 +15,7 @@ class BladeTest extends TestCase
/**
* @return array
*/
public function directiveProvider()
public static function directiveProvider()
{
return [['mobile'], ['desktop'], ['tablet']];
}
Expand All @@ -35,7 +36,7 @@ public function testDirectives($directive)
/**
* @return array
*/
public function directiveValuedProvider()
public static function directiveValuedProvider()
{
return [['mobile', false], ['desktop', true], ['tablet', false]];
}
Expand Down
7 changes: 4 additions & 3 deletions tests/ParserTest.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php

namespace hisorange\BrowserDetect\Test;

use hisorange\BrowserDetect\Contracts\ParserInterface;
use hisorange\BrowserDetect\Parser;
use hisorange\BrowserDetect\Contracts\ResultInterface;
use hisorange\BrowserDetect\Exceptions\InvalidArgumentException;

/**
* Class ParserTest
Expand Down Expand Up @@ -82,7 +83,7 @@ public function testStandaloneRuntimeCache()
*
* @return \hisorange\BrowserDetect\Contracts\ParserInterface
*/
protected function getParser()
protected function getParser(): ParserInterface
{
return $this->app->make('browser-detect');
}
Expand All @@ -108,7 +109,7 @@ public function testParse($agent)
/**
* @return array
*/
public function provideAgents()
public static function provideAgents()
{
return [
['Unknown'],
Expand Down
2 changes: 1 addition & 1 deletion tests/Stages/BrowserDetectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ public function testInAppAndroid()
*
* @return array
*/
public function provideScenarios()
public static function provideScenarios()
{
return [
[
Expand Down
Loading

0 comments on commit 08a3bd3

Please sign in to comment.