Skip to content

Commit

Permalink
update dev dependencies, set up GitHub Actions and bump minimum versi…
Browse files Browse the repository at this point in the history
…on to PHP 7.3
  • Loading branch information
1ma committed Dec 26, 2020
1 parent fd8c07f commit bd5e79b
Show file tree
Hide file tree
Showing 13 changed files with 97 additions and 53 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
/.gitignore export-ignore
/.scrutinizer.yml export-ignore
/.travis.yml export-ignore
/phpunit.xml.dist export-ignore
/phpunit.xml export-ignore
/README.md export-ignore
35 changes: 35 additions & 0 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
on: push

jobs:
php73:
runs-on: ubuntu-latest
container: 1maa/php-dev:7.3
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Run tests in PHP 7.3
run: |
composer install
composer test
php74:
runs-on: ubuntu-latest
container: 1maa/php-dev:7.4
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Run tests in PHP 7.4
run: |
composer install
composer test
php80:
runs-on: ubuntu-latest
container: 1maa/php-dev:8.0
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Run tests in PHP 8.0
run: |
composer install
composer test
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/build/
/composer.lock
/phpunit.xml
/vendor/

*.phar
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2016-2019 Marcel Hernandez
Copyright (c) 2016-2021 Marcel Hernandez

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
20 changes: 10 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
{
"name": "uma/psr7-hmac",
"description": "An HMAC authentication library built on top of the PSR-7 specification",
"type": "library",
"license": "MIT",
"type": "library",
"keywords": ["http", "psr7", "hmac"],
"homepage": "https://github.com/1ma/Psr7Hmac",
"support": {
"issues": "https://github.com/1ma/Psr7Hmac/issues",
"source": "https://github.com/1ma/Psr7Hmac"
},
"require": {
"php": ">=7.1",
"psr/http-message": "^1.0.0",
"php": "^7.3.0 || ^7.4.0 || ^8.0.0",
"psr/http-message": "^1.0",
"psr/http-server-middleware": "^1.0"
},
"require-dev": {
"guzzlehttp/psr7": "^1.3",
"kambo/httpmessage": "^0.9.0",
"laminas/laminas-diactoros": "^2.5",
"nyholm/psr7": "^1.0",
"phpmetrics/phpmetrics": "^2.4",
"phpunit/phpunit": "^7.5",
"phpmetrics/phpmetrics": "^2.7",
"phpunit/phpunit": "^9.5",
"ringcentral/psr7": "^1.2",
"slim/slim": "^3.4",
"symfony/psr-http-message-bridge": "^1.1",
"symfony/psr-http-message-bridge": "^2.0",
"wandu/http": "^3.0",
"windwalker/http": "^3.1",
"zendframework/zend-diactoros": "^1.8"
"windwalker/http": "^3.1"
},
"autoload": {
"psr-4": {
Expand All @@ -38,10 +38,10 @@
}
},
"scripts": {
"test": "php vendor/bin/phpunit",
"test": "php -dzend.assertions=1 -dassert.exception=1 vendor/bin/phpunit",
"metrics": [
"@test",
"vendor/bin/phpmetrics --junit=./build/phpunit/junit.xml --report-html=./build/phpmetrics ."
"vendor/bin/phpmetrics --junit=./build/junit.xml --report-html=./build/metrics ."
]
},
"config": {
Expand Down
35 changes: 35 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
beStrictAboutOutputDuringTests="true"
beStrictAboutTodoAnnotatedTests="true"
cacheResult="false"
executionOrder="depends,defects"
failOnRisky="true"
failOnWarning="true"
testdox="true"
verbose="true"
>
<testsuites>
<testsuite name="uma/psr7-hmac test suite">
<directory>tests</directory>
</testsuite>
</testsuites>

<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">src</directory>
</include>
<report>
<clover outputFile="build/coverage.xml"/>
<html outputDirectory="build/coverage"/>
<text outputFile="php://stdout" showOnlySummary="true"/>
</report>
</coverage>

<logging>
<junit outputFile="build/junit.xml"/>
</logging>
</phpunit>
27 changes: 0 additions & 27 deletions phpunit.xml.dist

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@

namespace UMA\Tests\Psr7Hmac\Factory;

use Laminas\Diactoros\Request;
use Laminas\Diactoros\Stream;
use Psr\Http\Message\RequestInterface;
use Zend\Diactoros\Request;
use Zend\Diactoros\Stream;

class ZendFactory implements FactoryInterface
class LaminasFactory implements FactoryInterface
{
use StreamHelper;

Expand Down
12 changes: 7 additions & 5 deletions tests/Factory/SymfonyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@

namespace UMA\Tests\Psr7Hmac\Factory;

use Nyholm\Psr7\Factory\Psr17Factory;
use Nyholm\Psr7\ServerRequest as NyholmRequest;
use Psr\Http\Message\RequestInterface;
use Symfony\Bridge\PsrHttpMessage\Factory\DiactorosFactory;
use Symfony\Bridge\PsrHttpMessage\Factory\PsrHttpFactory;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
use Zend\Diactoros\ServerRequest as ZendRequest;

final class SymfonyFactory implements FactoryInterface
{
/**
* {@inheritdoc}
*
* @return ZendRequest
* @return NyholmRequest
*/
public static function request(string $method, string $url, array $headers = [], string $body = null): RequestInterface
{
Expand All @@ -27,7 +28,8 @@ public static function request(string $method, string $url, array $headers = [],

$symfonyRequest->headers->add($headers);

return (new DiactorosFactory())
$factory = new Psr17Factory();
return (new PsrHttpFactory($factory, $factory, $factory, $factory))
->createRequest($symfonyRequest);
}

Expand All @@ -39,7 +41,7 @@ public static function requestClass(): string
// This is indeed a white lie, as the HttpFoundation component
// is not a PSR-7 implementation.

// Instead, the returned requests are actually Zend\Diactoros\ServerRequest
// Instead, the returned requests are actually Nyholm\Psr7\ServerRequest
// instances produced by Symfony's own PSR-7 bridge.
return SymfonyRequest::class;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/FullSpectrumTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ final class FullSpectrumTest extends TestCase
/**
* {@inheritdoc}
*/
protected function setUp()
protected function setUp(): void
{
$this->signer = new Signer(self::SECRET);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Psr15/HmacMiddlewareTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class HmacMiddlewareTest extends TestCase
*/
private $signer;

protected function setUp()
protected function setUp(): void
{
$this->signer = new Signer(self::SAMPLE_SECRET);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/RequestsProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
use Psr\Http\Message\RequestInterface;
use UMA\Tests\Psr7Hmac\Factory\GuzzleFactory;
use UMA\Tests\Psr7Hmac\Factory\KamboFactory;
use UMA\Tests\Psr7Hmac\Factory\LaminasFactory;
use UMA\Tests\Psr7Hmac\Factory\NyholmFactory;
use UMA\Tests\Psr7Hmac\Factory\RingCentralFactory;
use UMA\Tests\Psr7Hmac\Factory\SlimFactory;
use UMA\Tests\Psr7Hmac\Factory\SymfonyFactory;
use UMA\Tests\Psr7Hmac\Factory\WanduFactory;
use UMA\Tests\Psr7Hmac\Factory\WindwalkerFactory;
use UMA\Tests\Psr7Hmac\Factory\ZendFactory;

trait RequestsProvider
{
Expand Down Expand Up @@ -120,13 +120,13 @@ private function requests(string $method, string $url, array $headers = [], stri
return [
GuzzleFactory::requestClass() => [GuzzleFactory::request($method, $url, $headers, $body)],
KamboFactory::requestClass() => [KamboFactory::request($method, $url, $headers, $body)],
LaminasFactory::requestClass() => [LaminasFactory::request($method, $url, $headers, $body)],
NyholmFactory::requestClass() => [NyholmFactory::request($method, $url, $headers, $body)],
RingCentralFactory::requestClass() => [RingCentralFactory::request($method, $url, $headers, $body)],
SlimFactory::requestClass() => [SlimFactory::request($method, $url, $headers, $body)],
SymfonyFactory::requestClass() => [SymfonyFactory::request($method, $url, $headers, $body)],
WanduFactory::requestClass() => [WanduFactory::request($method, $url, $headers, $body)],
WindwalkerFactory::requestClass() => [WindwalkerFactory::request($method, $url, $headers, $body)],
ZendFactory::requestClass() => [ZendFactory::request($method, $url, $headers, $body)],
];
}
}
2 changes: 1 addition & 1 deletion tests/VerifierTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ final class VerifierTest extends TestCase
/**
* {@inheritdoc}
*/
protected function setUp()
protected function setUp(): void
{
$this->verifier = new Verifier();
}
Expand Down

0 comments on commit bd5e79b

Please sign in to comment.