Skip to content

Commit c0d5266

Browse files
author
n.gnato
committed
Prepare ci, update project info
1 parent 54b7485 commit c0d5266

4 files changed

Lines changed: 83 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: CI
2+
3+
on:
4+
- push
5+
- pull_request
6+
7+
jobs:
8+
php-tests:
9+
strategy:
10+
matrix:
11+
php:
12+
- 7.4
13+
- 8.0
14+
- 8.1
15+
- 8.2
16+
- 8.3
17+
- 8.4
18+
prefer:
19+
- lowest
20+
- stable
21+
fail-fast: false
22+
23+
name: Test on PHP ${{ matrix.php }} with ${{ matrix.prefer }} composer prefer option
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Checkout Code
28+
uses: actions/checkout@v3
29+
30+
- name: Install PHP
31+
uses: shivammathur/setup-php@v2
32+
with:
33+
php-version: ${{ matrix.php }}
34+
35+
- name: Check PHP Version
36+
run: php -v
37+
38+
- name: Xdebug Action
39+
uses: MilesChou/docker-xdebug@master
40+
41+
- name: Cache Composer packages
42+
id: composer-cache
43+
uses: actions/cache@v3
44+
with:
45+
path: vendor
46+
key: ${{ runner.os }}-php-${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}-${{ matrix.prefer }}-
47+
restore-keys: |
48+
${{ runner.os }}-php-${{ matrix.php }}-composer-${{ matrix.prefer }}-
49+
- name: Install dependencies
50+
if: steps.composer-cache.outputs.cache-hit != 'true'
51+
run: composer update --prefer-${{ matrix.prefer }} --prefer-dist --no-progress
52+
53+
- name: Run tests
54+
env:
55+
XDEBUG_MODE: coverage
56+
run: vendor/bin/phpunit

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local
1313
# Composer requirements end
1414

1515
# Xdebug begin
16-
RUN pecl install xdebug \
16+
RUN pecl install xdebug-3.1.6 \
1717
&& docker-php-ext-enable xdebug
1818

1919
# Xdebug end

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
11
# Static Http Client
22

33
[PSR-18](http://www.php-fig.org/psr/psr-18) implementation for testing. Use static files for mock responses and write requests.
4+
5+
## Installation
6+
7+
```shell
8+
composer require free-elephants/static-http-client --dev
9+
```
10+
11+
## Usage
12+
13+
```php
14+
public function test()
15+
{
16+
$stubbedHttpClient = new \FreeElephants\StaticHttpClient\StaticHttpClient(
17+
$responseFactory,
18+
new \FreeElephants\StaticHttpClient\PathResolver\HostnameAwareResolver()
19+
);
20+
21+
$response = $stubbedHttpClient->sendRequest();
22+
}
23+
```

composer.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"helmich/phpunit-psr7-assert": "^4.2",
1212
"nyholm/psr7": "^1.3"
1313
},
14+
"suggest": {
15+
"nyholm/psr7": "*"
16+
},
1417
"license": "BSD-3-Clause",
1518
"authors": [
1619
{
@@ -31,5 +34,8 @@
3134
"tests/FreeElephants/StaticHttpClient"
3235
]
3336
}
37+
},
38+
"config": {
39+
"sort-packages": true
3440
}
3541
}

0 commit comments

Comments
 (0)