Skip to content

Upgrade dependencies and automated tests with GitHub Actions #90

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Tests with PHPUnit

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Validate composer.json and composer.lock
run: composer validate --strict

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-

- name: Install dependencies
run: composer install --prefer-dist --no-progress

- name: Run test suite
run: composer run-script test
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
language: php

php:
- 7.1
- 7.2
- 7.3
- 7.4
- 8.0

sudo: false

dist: trusty
dist: bionic

before_script:
- composer self-update
Expand Down
17 changes: 10 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
}
],
"require": {
"php": "^5.6 || ^7.0",
"php": ">=7.3",
"psr/http-message": "^1.0",
"guzzlehttp/guzzle": "^6.0",
"laminas/laminas-diactoros": "^2.0",
"guzzlehttp/guzzle": "^7.3",
"laminas/laminas-diactoros": "^2.6",
"relay/relay": "^1.0",
"laminas/laminas-httphandlerrunner": "^1.1"
"laminas/laminas-httphandlerrunner": "^2.0"
},
"require-dev": {
"phpunit/phpunit": "^5.0|^6.0|^7.0",
"php-coveralls/php-coveralls": "^2.0",
"mockery/mockery": "^1.1"
"phpunit/phpunit": "^9.0",
"php-coveralls/php-coveralls": "^2.4",
"mockery/mockery": "^1.4"
},
"autoload": {
"psr-4": {
Expand All @@ -37,5 +37,8 @@
"psr-4": {
"Proxy\\": "tests"
}
},
"scripts": {
"test": "vendor/bin/phpunit"
}
}
24 changes: 13 additions & 11 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
Expand All @@ -9,14 +11,14 @@
processIsolation="false"
stopOnFailure="true"
>
<testsuites>
<testsuite name="PHPProxy Test Suite">
<directory>tests/Proxy/</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<coverage>
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="PHPProxy Test Suite">
<directory>tests/Proxy/</directory>
</testsuite>
</testsuites>
</phpunit>
2 changes: 1 addition & 1 deletion tests/Proxy/Adapter/Dummy/DummyAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class DummyAdapterTest extends TestCase
*/
private $adapter;

public function setUp()
public function setUp(): void
{
$this->adapter = new DummyAdapter();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Proxy/Adapter/Guzzle/GuzzleAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class GuzzleAdapterTest extends TestCase
*/
private $body = 'Totally awesome response body';

public function setUp()
public function setUp(): void
{
$mock = new MockHandler([
$this->createResponse(),
Expand Down
2 changes: 1 addition & 1 deletion tests/Proxy/Filter/RemoveEncodingFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class RemoveEncodingFilterTest extends TestCase
*/
private $filter;

public function setUp()
public function setUp(): void
{
$this->filter = new RemoveEncodingFilter();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Proxy/Filter/RemoveLocationFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class RemoveLocationFilterTest extends TestCase
*/
private $filter;

public function setUp()
public function setUp(): void
{
$this->filter = new RemoveLocationFilter();
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Proxy/Filter/RewriteLocationFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class RewriteLocationFilterTest extends TestCase
*/
private $filter;

public function setUp()
public function setUp(): void
{
$this->filter = new RewriteLocationFilter();
}
Expand Down
7 changes: 3 additions & 4 deletions tests/Proxy/ProxyTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ class ProxyTest extends TestCase
*/
private $proxy;

public function setUp()
public function setUp(): void
{
$this->proxy = new Proxy(new DummyAdapter());
}

/**
* @test
* @expectedException UnexpectedValueException
*/
public function to_throws_exception_if_no_request_is_given()
{
$this->expectException('UnexpectedValueException');
$this->proxy->to('http://www.example.com');
}

Expand All @@ -48,8 +48,7 @@ public function to_applies_filters()
{
$applied = false;

$this->proxy->forward(ServerRequestFactory::fromGlobals())->filter(function ($request, $response) use (&$applied
) {
$this->proxy->forward(ServerRequestFactory::fromGlobals())->filter(function ($request, $response) use (&$applied) {
$applied = true;
})->to('http://www.example.com');

Expand Down