Skip to content

Commit

Permalink
Merge pull request #103 from auraphp/making80compat
Browse files Browse the repository at this point in the history
Making compatible with PHP 7.4 and 8.0.
  • Loading branch information
brandonsavage authored Dec 15, 2021
2 parents d9fff63 + 927b072 commit c88b713
Show file tree
Hide file tree
Showing 24 changed files with 125 additions and 99 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
on:
pull_request:
push:
branches:
- '**'

name: "Continuous Integration"

jobs:
unit-tests:
name: "Unit Tests"
runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "7.2"
- "7.3"
- "7.4"
- "8.0"
- "8.1"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
ini-values: "memory_limit=-1"
php-version: "${{ matrix.php-version }}"

- name: "Determine composer cache directory"
id: "determine-composer-cache-directory"
run: "echo \"::set-output name=directory::$(composer config cache-dir)\""

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1"
with:
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}"
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-"

- name: "Install dependencies with composer"
run: "composer install --no-interaction --no-progress --no-suggest"

- name: "Run tests with phpunit/phpunit"
run: "vendor/bin/phpunit"

psalm-tests:
name: "Psalm Tests"
runs-on: "ubuntu-latest"

strategy:
matrix:
php-version:
- "8.1"

steps:
- name: "Checkout"
uses: "actions/checkout@v2"

- name: "Install PHP with extensions"
uses: "shivammathur/setup-php@v2"
with:
coverage: "none"
ini-values: "memory_limit=-1"
php-version: "${{ matrix.php-version }}"

- name: "Determine composer cache directory"
id: "determine-composer-cache-directory"
run: "echo \"::set-output name=directory::$(composer config cache-dir)\""

- name: "Cache dependencies installed with composer"
uses: "actions/cache@v1"
with:
path: "${{ steps.determine-composer-cache-directory.outputs.directory }}"
key: "php-${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}"
restore-keys: "php-${{ matrix.php-version }}-composer-"

- name: "Install dependencies with composer"
run: "composer install --no-interaction --no-progress --no-suggest"

- name: "Run tests with Psalm"
run: "vendor/bin/psalm"

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/vendor
/composer.lock
.phpunit.result.cache
phpunit.xml
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
}
},

"minimum-stability": "dev",
"minimum-stability": "stable",
"require-dev": {
"acclimate/container": "^2",
"aura/di": "~4.0",
"phpunit/phpunit": "~7"
"phpunit/phpunit": "~8",
"vimeo/psalm": "~v4.15"
},
"autoload-dev": {
"psr-4": {
Expand Down
15 changes: 15 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0"?>
<psalm
errorLevel="7"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="src" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
2 changes: 1 addition & 1 deletion src/Verifier/PasswordVerifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct($algo)
*/
public function verify($plaintext, $hashvalue, array $extra = array())
{
if (is_string($this->algo)) {
if (is_string($this->algo) && $this->algo !== PASSWORD_BCRYPT) {
return hash($this->algo, $plaintext) === $hashvalue;
} else {
return password_verify($plaintext, $hashvalue);
Expand Down
2 changes: 1 addition & 1 deletion tests/Adapter/HtpasswdAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class HtpasswdAdapterTest extends \PHPUnit\Framework\TestCase
{
protected $adapter;

protected function setUp()
protected function setUp() : void
{
$file = dirname(__DIR__) . DIRECTORY_SEPARATOR . 'fake.htpasswd';
$this->setAdapter($file);
Expand Down
2 changes: 1 addition & 1 deletion tests/Adapter/ImapAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ImapAdapterTest extends \PHPUnit\Framework\TestCase

protected $adapter;

protected function setUp()
protected function setUp() : void
{
$this->phpfunc = $this->getMockBuilder('Aura\Auth\Phpfunc')
->setMethods(array(
Expand Down
2 changes: 1 addition & 1 deletion tests/Adapter/LdapAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class LdapAdapterTest extends \PHPUnit\Framework\TestCase

protected $phpfunc;

protected function setUp()
protected function setUp() : void
{
$this->phpfunc = $this->getMockBuilder('Aura\Auth\Phpfunc')
->setMethods(array(
Expand Down
2 changes: 1 addition & 1 deletion tests/Adapter/NullAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class NullAdapterTest extends \PHPUnit\Framework\TestCase
{
protected $adapter;

protected function setUp()
protected function setUp() : void
{
$this->adapter = new NullAdapter;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Adapter/PdoAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class PdoAdapterTest extends \PHPUnit\Framework\TestCase

protected $pdo;

protected function setUp()
protected function setUp() : void
{
if (false === extension_loaded('pdo_sqlite')) {
$this->markTestSkipped("Cannot test this adapter with pdo_sqlite extension disabled.");
Expand Down
2 changes: 1 addition & 1 deletion tests/AuthFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class AuthFactoryTest extends \PHPUnit\Framework\TestCase
{
protected $factory;

protected function setUp()
protected function setUp() : void
{
$this->factory = new AuthFactory($_COOKIE);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/AuthTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class AuthTest extends \PHPUnit\Framework\TestCase

protected $segment;

protected function setUp()
protected function setUp() : void
{
$this->segment = new FakeSegment;
$this->auth = new Auth($this->segment);
Expand Down
57 changes: 0 additions & 57 deletions tests/ContainerTest.php

This file was deleted.

2 changes: 1 addition & 1 deletion tests/PhpfuncTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class PhpfuncTest extends \PHPUnit\Framework\TestCase
{
protected $phpfunc;

protected function setUp()
protected function setUp() : void
{
$this->phpfunc = new Phpfunc;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Service/LoginServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class LoginServiceTest extends \PHPUnit\Framework\TestCase

protected $login_service;

protected function setUp()
protected function setUp() : void
{
$this->segment = new FakeSegment;
$this->session = new FakeSession;
Expand Down
2 changes: 1 addition & 1 deletion tests/Service/LogoutServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class LogoutServiceTest extends \PHPUnit\Framework\TestCase

protected $logout_service;

protected function setUp()
protected function setUp() : void
{
$this->segment = new FakeSegment;
$this->session = new FakeSession;
Expand Down
2 changes: 1 addition & 1 deletion tests/Service/ResumeServiceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ResumeServiceTest extends \PHPUnit\Framework\TestCase

protected $resume_service;

protected function setUp()
protected function setUp() : void
{
$this->segment = new FakeSegment;
$this->session = new FakeSession;
Expand Down
2 changes: 1 addition & 1 deletion tests/Session/NullSegmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class NullSegmentTest extends \PHPUnit\Framework\TestCase
{
protected $segment;

public function setUp()
public function setUp() : void
{
$this->segment = new NullSegment;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Session/NullSessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class NullSessionTest extends \PHPUnit\Framework\TestCase
{
protected $session;

protected function setUp()
protected function setUp() : void
{
$this->session = new NullSession;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Session/SegmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class SegmentTest extends \PHPUnit\Framework\TestCase
{
protected $segment;

public function setUp()
public function setUp() : void
{
$this->segment = new Segment(__CLASS__);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Session/SessionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/
class SessionTest extends \PHPUnit\Framework\TestCase
{
protected function setUp()
protected function setUp() : void
{
$this->setSession();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Session/TimerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class TimerTest extends \PHPUnit\Framework\TestCase
{
protected $timer;

protected function setUp()
protected function setUp() : void
{
$this->timer = new Timer(3600, 86400);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Verifier/HtpasswdVerifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

class HtpasswdVerifierTest extends \PHPUnit\Framework\TestCase
{
public function setUp()
public function setUp() : void
{
$this->verifier = new HtpasswdVerifier;
}
Expand Down

0 comments on commit c88b713

Please sign in to comment.