Skip to content

Commit f6cae27

Browse files
committed
fix #3: map inner properties data objects
1 parent 4f30d2f commit f6cae27

26 files changed

Lines changed: 3416 additions & 471 deletions

.github/workflows/test.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Test
2+
on: [push]
3+
jobs:
4+
lint:
5+
name: PHP Test
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Setup PHP
9+
uses: shivammathur/setup-php@v2
10+
with:
11+
php-version: 8.1
12+
13+
- name: Cache Composer dependencies
14+
uses: actions/cache@v2
15+
with:
16+
path: /tmp/composer-cache
17+
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
18+
19+
- uses: actions/checkout@master
20+
- name: test
21+
run: make test

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
/.idea
33
.phpcs-cache
44
index.php
5+
.phpunit.result.cache
6+
.phpunit.cache

Makefile

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,40 @@
1+
.DEFAULT_GOAL := help
2+
3+
# -----------------------------------
4+
# Variables
5+
# -----------------------------------
6+
is_docker := $(shell docker info > /dev/null 2>&1 && echo 1)
7+
user := $(shell id -u)
8+
group := $(shell id -g)
9+
10+
ifeq ($(is_docker), 1)
11+
php := USER_ID=$(user) GROUP_ID=$(group) docker-compose run --rm --no-deps php
12+
composer := $(php) composer
13+
else
14+
php := php
15+
composer := composer
16+
endif
17+
18+
# -----------------------------------
19+
# Recipes
20+
# -----------------------------------
121
.PHONY: help
222
help: ## affiche cet aide
323
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
424

525
.PHONY: lint
626
lint: vendor/autoload.php ## affiche les erreurs de formatage de code
7-
php vendor/bin/phpcs -s
8-
php vendor/bin/ecs check
9-
php vendor/bin/phpstan
27+
$(php) vendor/bin/ecs
28+
$(php) vendor/bin/phpstan
29+
30+
.PHONY: test
31+
test: vendor/autoload.php ## lance les tests
32+
$(php) vendor/bin/phpunit
33+
34+
.PHONY: lint-fix
35+
lint-fix: vendor/autoload.php ## corrige les erreurs de formatage de code
36+
$(php) vendor/bin/ecs --fix
1037

1138
vendor/autoload.php: composer.lock # installe les dépendances PHP
12-
composer update
13-
composer dump-autoload
39+
$(composer) update
40+
$(composer) dump-autoload

composer.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
"Devscast\\Pexels\\": "src/"
1515
}
1616
},
17+
"autoload-dev": {
18+
"psr-4": {
19+
"Devscast\\Pexels\\Tests\\": "tests/"
20+
}
21+
},
1722
"authors": [
1823
{
1924
"name": "bernard-ng",
@@ -32,6 +37,7 @@
3237
"php": ">=8.1",
3338
"symfony/http-client": "^6.1|^7.0",
3439
"symfony/serializer": "^6.1|^7.0",
35-
"symfony/property-access": "^6.1|^7.0"
40+
"symfony/property-access": "^6.1|^7.0",
41+
"phpunit/phpunit": "^9"
3642
}
3743
}

0 commit comments

Comments
 (0)