Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #97 from adlenton/php-8-support
Browse files Browse the repository at this point in the history
PHP 8 Support
  • Loading branch information
gabrielbull authored Oct 29, 2020
2 parents 5f18a41 + 6402981 commit 16cad9c
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 60 deletions.
14 changes: 4 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,14 @@ env:
- APP_ENV=travis

php:
- 5.3.3
- 5.4
- 5.5
- 5.6
- 7.0
- 7.1
- 7.2
- 7.3
- 7.4
- nightly #php 8
- hhvm

before_script:
- composer install --no-interaction

script:
- phpunit

matrix:
allow_failures:
- php: 5.3.3
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
}
],
"require": {
"php": "^5.3.3 || ^7.0"
"php": ">=7.2"
},
"require-dev": {
"phpunit/phpunit": "^4.8 || ^5.0"
"phpunit/phpunit": "^8.0 || ^9.4"
},
"autoload": {
"psr-4": {
Expand Down
30 changes: 11 additions & 19 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
bootstrap="tests/bootstrap.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
verbose="true"
>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="true" beStrictAboutOutputDuringTests="true"
bootstrap="tests/bootstrap.php" colors="true" convertErrorsToExceptions="true"
convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false"
stopOnError="false" stopOnFailure="false" verbose="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Browser Detector Test Suite">
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</phpunit>
4 changes: 2 additions & 2 deletions tests/BrowserDetector/Tests/AcceptLanguageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Sinergi\BrowserDetector\Tests;

use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use Sinergi\BrowserDetector\AcceptLanguage;

class AcceptLanguageTest extends PHPUnit_Framework_TestCase
class AcceptLanguageTest extends TestCase
{
public function testObject()
{
Expand Down
4 changes: 2 additions & 2 deletions tests/BrowserDetector/Tests/BrowserDetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Sinergi\BrowserDetector\Tests;

use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use Sinergi\BrowserDetector\Browser;

class BrowserDetectorTest extends PHPUnit_Framework_TestCase
class BrowserDetectorTest extends TestCase
{
public function testDetect()
{
Expand Down
4 changes: 2 additions & 2 deletions tests/BrowserDetector/Tests/BrowserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Sinergi\BrowserDetector\Tests;

use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use Sinergi\BrowserDetector\Browser;

// todo: move to browser detector tests
class BrowserTest extends PHPUnit_Framework_TestCase
class BrowserTest extends TestCase
{
public function testBlackBerry()
{
Expand Down
6 changes: 2 additions & 4 deletions tests/BrowserDetector/Tests/DeviceDetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@

namespace Sinergi\BrowserDetector\Tests;

use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use Sinergi\BrowserDetector\Device;
use Sinergi\BrowserDetector\DeviceDetector;
use Sinergi\BrowserDetector\UserAgent;

class DeviceDetectorTest extends PHPUnit_Framework_TestCase
class DeviceDetectorTest extends TestCase
{
public function testDeviceDetect()
{
Expand Down
4 changes: 2 additions & 2 deletions tests/BrowserDetector/Tests/DeviceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Sinergi\BrowserDetector\Tests;

use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use Sinergi\BrowserDetector\Device;

class DeviceTest extends PHPUnit_Framework_TestCase
class DeviceTest extends TestCase
{
public function testDevice()
{
Expand Down
13 changes: 6 additions & 7 deletions tests/BrowserDetector/Tests/LanguageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,19 @@

namespace Sinergi\BrowserDetector\Tests;

use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use Sinergi\BrowserDetector\AcceptLanguage;
use Sinergi\BrowserDetector\InvalidArgumentException;
use Sinergi\BrowserDetector\Language;

class LanguageTest extends PHPUnit_Framework_TestCase
class LanguageTest extends TestCase
{
/**
* @var Language
*/
private $language;

public function setUp()
public function setUp(): void
{
$httpAcceptLanguage = 'fr-CA,fr;q=0.8,en-CA;q=0.6,en;q=0.4,en-US;q=0.2';
$this->language = new Language($httpAcceptLanguage);
Expand Down Expand Up @@ -43,12 +44,10 @@ public function testConstructor()
$this->assertInstanceOf("\\Sinergi\\BrowserDetector\\Language", $language);
}

/**
* @expectedException \Sinergi\BrowserDetector\InvalidArgumentException
*/
public function testConstructorException()
{
$language = new Language(1);
$this->expectException(InvalidArgumentException::class);
new Language(1);
}

public function testGetLanguageLocale()
Expand Down
4 changes: 2 additions & 2 deletions tests/BrowserDetector/Tests/OsDetectorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Sinergi\BrowserDetector\Tests;

use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use Sinergi\BrowserDetector\Os;

class OsDetectorTest extends PHPUnit_Framework_TestCase
class OsDetectorTest extends TestCase
{
public function testDetect()
{
Expand Down
11 changes: 5 additions & 6 deletions tests/BrowserDetector/Tests/OsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

namespace Sinergi\BrowserDetector\Tests;

use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use Sinergi\BrowserDetector\InvalidArgumentException;
use Sinergi\BrowserDetector\Os;
use Sinergi\BrowserDetector\UserAgent;

// todo: move to os detector tests
class OsTest extends PHPUnit_Framework_TestCase
class OsTest extends TestCase
{
public function testIOs()
{
Expand Down Expand Up @@ -60,12 +61,10 @@ public function testConstructor()
$this->assertInstanceOf("\\Sinergi\\BrowserDetector\\Os", $os);
}

/**
* @expectedException \Sinergi\BrowserDetector\InvalidArgumentException
*/
public function testConstructorException()
{
$os = new Os(1);
$this->expectException(InvalidArgumentException::class);
new Os(1);
}

public function testGetVersion()
Expand Down
4 changes: 2 additions & 2 deletions tests/BrowserDetector/Tests/UserAgentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

namespace Sinergi\BrowserDetector\Tests;

use PHPUnit_Framework_TestCase;
use PHPUnit\Framework\TestCase;
use Sinergi\BrowserDetector\UserAgent;

class UserAgentTest extends PHPUnit_Framework_TestCase
class UserAgentTest extends TestCase
{
public function testObject()
{
Expand Down

0 comments on commit 16cad9c

Please sign in to comment.