Skip to content

Commit e8154b5

Browse files
Merge pull request php-vcr#345 from php-vcr/github-actions
Moving to Github Actions
2 parents 71a2ede + 2267d78 commit e8154b5

File tree

6 files changed

+167
-59
lines changed

6 files changed

+167
-59
lines changed

.github/workflows/tests.yml

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
name: "tests"
2+
3+
on:
4+
push:
5+
branches:
6+
- "master"
7+
pull_request:
8+
9+
jobs:
10+
phpstan:
11+
name: "PHPStan"
12+
runs-on: "ubuntu-latest"
13+
steps:
14+
- name: "Checkout code"
15+
uses: "actions/checkout@v2"
16+
17+
- name: "Setup PHP"
18+
uses: "shivammathur/setup-php@v2"
19+
with:
20+
php-version: "7.3"
21+
extensions: "curl, soap"
22+
tools: "composer:v2"
23+
24+
- name: "Check Composer configuration"
25+
run: "composer validate --strict"
26+
27+
- name: "Install dependencies"
28+
run: "composer update --prefer-dist --no-interaction --no-progress"
29+
30+
- name: "Execute static analysis"
31+
run: "composer run-script phpstan"
32+
33+
lint:
34+
name: "PHP-CS-Fixer"
35+
runs-on: "ubuntu-latest"
36+
steps:
37+
- name: "Checkout code"
38+
uses: "actions/checkout@v2"
39+
40+
- name: "Setup PHP"
41+
uses: "shivammathur/setup-php@v2"
42+
with:
43+
php-version: "7.3"
44+
extensions: "curl, soap"
45+
tools: "composer:v2"
46+
47+
- name: "Check Composer configuration"
48+
run: "composer validate --strict"
49+
50+
- name: "Install dependencies"
51+
run: "composer update --prefer-dist --no-interaction --no-progress"
52+
53+
- name: "Execute linting"
54+
run: "composer run-script lint"
55+
56+
tests:
57+
strategy:
58+
fail-fast: true
59+
matrix:
60+
php: ["7.3", "7.4"]
61+
composer_flags: ["", "--prefer-lowest"]
62+
63+
name: "Tests PHP ${{ matrix.php }} ${{ matrix.composer_flags}}"
64+
65+
runs-on: "ubuntu-latest"
66+
67+
steps:
68+
- name: "Checkout code"
69+
uses: "actions/checkout@v2"
70+
71+
- name: "Setup PHP"
72+
uses: "shivammathur/setup-php@v2"
73+
with:
74+
php-version: "${{ matrix.php }}"
75+
extensions: "curl, soap"
76+
tools: "composer:v2"
77+
coverage: "pcov"
78+
79+
- name: "Check Composer configuration"
80+
run: "composer validate --strict"
81+
82+
- name: "Install dependencies"
83+
run: "composer update -o ${{ matrix.composer_flags }} --prefer-dist --no-interaction --no-progress"
84+
85+
- name: "Execute tests"
86+
run: "vendor/bin/phpunit --coverage-clover=coverage.clover"
87+
88+
- name: "Upload code coverage"
89+
run: "wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover"
90+
91+
guzzle:
92+
strategy:
93+
fail-fast: true
94+
matrix:
95+
guzzle: ["3", "5", "6"]
96+
97+
name: "Integration test for Guzzle ${{ matrix.guzzle }}"
98+
99+
runs-on: "ubuntu-latest"
100+
101+
steps:
102+
- name: "Checkout code"
103+
uses: "actions/checkout@v2"
104+
105+
- name: "Setup PHP"
106+
uses: "shivammathur/setup-php@v2"
107+
with:
108+
php-version: "7.3"
109+
extensions: "curl, soap"
110+
tools: "composer:v2"
111+
coverage: "pcov"
112+
113+
- name: "Check Composer configuration"
114+
run: "composer validate --strict"
115+
116+
- name: "Install dependencies"
117+
run: "composer update --prefer-dist --no-interaction --no-progress"
118+
119+
- name: "Execute tests"
120+
run: "cd tests/integration/guzzle/${{ matrix.guzzle }}/ && composer update --prefer-dist --no-interaction --no-progress && ../../../../vendor/bin/phpunit --coverage-clover=coverage.clover"
121+
122+
- name: "Upload code coverage"
123+
run: "wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover"
124+
125+
soap:
126+
strategy:
127+
fail-fast: true
128+
129+
name: "SOAP integration test"
130+
131+
runs-on: "ubuntu-latest"
132+
133+
steps:
134+
- name: "Checkout code"
135+
uses: "actions/checkout@v2"
136+
137+
- name: "Setup PHP"
138+
uses: "shivammathur/setup-php@v2"
139+
with:
140+
php-version: "7.3"
141+
extensions: "curl, soap"
142+
tools: "composer:v2"
143+
coverage: "pcov"
144+
145+
- name: "Check Composer configuration"
146+
run: "composer validate --strict"
147+
148+
- name: "Install dependencies"
149+
run: "composer update --prefer-dist --no-interaction --no-progress"
150+
151+
- name: "Execute tests"
152+
run: "cd tests/integration/soap/ && composer update --prefer-dist --no-interaction --no-progress && ../../../vendor/bin/phpunit --coverage-clover=coverage.clover"
153+
154+
- name: "Upload code coverage"
155+
run: "wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover"

.travis.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![PHP-VCR](https://user-images.githubusercontent.com/133832/27151811-0d95c6c4-514c-11e7-834e-eff1eec2ea16.png)
22

3-
[![Build Status](https://travis-ci.org/php-vcr/php-vcr.svg?branch=master)](https://travis-ci.org/php-vcr/php-vcr)
3+
[![Build Status](https://github.com/php-vcr/php-vcr/actions/workflows/tests.yml/badge.svg)](https://github.com/php-vcr/php-vcr/actions/workflows/tests.yml)
44
[![Code Coverage](https://scrutinizer-ci.com/g/php-vcr/php-vcr/badges/coverage.png?s=15cf1644c8cf37a868e03cfba809a5e24c78f285)](https://scrutinizer-ci.com/g/php-vcr/php-vcr/)
55
[![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/php-vcr/php-vcr/badges/quality-score.png?s=4f638dbca5eb51fb9c87a1dd45c5df94687d85bd)](https://scrutinizer-ci.com/g/php-vcr/php-vcr/)
66

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,10 @@
3434
"psr-4": {
3535
"VCR\\": "src/VCR/"
3636
}
37+
},
38+
"autoload-dev": {
39+
"classmap": [
40+
"tests/"
41+
]
3742
}
3843
}

tests/integration/guzzle/6/test/AsyncTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
*/
1212
class AsyncTest extends TestCase
1313
{
14-
public const TEST_GET_URL = 'https://api.chew.pro/trbmb';
15-
public const TEST_GET_URL_2 = 'https://api.chew.pro/trbmb?foo=42';
14+
public const TEST_GET_URL = 'https://httpbin.org/get';
15+
public const TEST_GET_URL_2 = 'https://httpbin.org/get?foo=42';
1616

1717
protected function setUp(): void
1818
{
@@ -33,14 +33,14 @@ public function testAsyncLock(): void
3333
// Let's check that we can perform 2 async request on different URLs without locking.
3434
// Solves https://github.com/php-vcr/php-vcr/issues/211
3535

36-
$this->assertValidGETResponse(\GuzzleHttp\json_decode($response->getBody()));
36+
$this->assertValidGETResponse(\GuzzleHttp\json_decode($response->getBody(), true));
3737

3838
\VCR\VCR::turnOff();
3939
}
4040

4141
protected function assertValidGETResponse($info): void
4242
{
4343
$this->assertIsArray($info, 'Response is not an array.');
44-
$this->assertArrayHasKey('0', $info, 'API did not return any value.');
44+
$this->assertArrayHasKey('url', $info, 'API did not return any value.');
4545
}
4646
}

tests/integration/guzzle/test/VCR/Example/ExampleHttpClientTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*/
1111
class ExampleHttpClientTest extends TestCase
1212
{
13-
public const TEST_GET_URL = 'https://api.chew.pro/trbmb';
13+
public const TEST_GET_URL = 'https://httpbin.org/get';
1414
public const TEST_POST_URL = 'https://httpbin.org/post';
1515
public const TEST_POST_BODY = '{"foo":"bar"}';
1616

@@ -90,7 +90,7 @@ protected function requestPOSTIntercepted()
9090
protected function assertValidGETResponse($info): void
9191
{
9292
$this->assertIsArray($info, 'Response is not an array.');
93-
$this->assertArrayHasKey('0', $info, 'API did not return any value.');
93+
$this->assertArrayHasKey('url', $info, 'API did not return any value.');
9494
}
9595

9696
protected function assertValidPOSTResponse($info): void

0 commit comments

Comments
 (0)