Skip to content

Commit a523334

Browse files
authored
Improve (#6)
1 parent 89b5b3c commit a523334

File tree

8 files changed

+34
-29
lines changed

8 files changed

+34
-29
lines changed

Makefile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ COVERAGE_OUTPUT_STYLE ?= html
66
BUILD_DIRECTORY ?= build
77
REPORTS_DIRECTORY ?= ${BUILD_DIRECTORY}/reports
88
COVERAGE_DIRECTORY ?= ${BUILD_DIRECTORY}/coverage
9+
BEHAT_COVERAGE_DIRECTORY ?= ${BUILD_DIRECTORY}/behat-coverage
910
COVERAGE_CLOVER_FILE_PATH ?= ${COVERAGE_DIRECTORY}/clover.xml
1011

1112
## Commands options
1213
### Composer
1314
#COMPOSER_OPTIONS=
1415
### Phpcs
1516
PHPCS_REPORT_STYLE ?= full
17+
PHPCS_DISABLE_WARNING ?= "false"
1618
#PHPCS_REPORT_FILE=
1719
#PHPCS_REPORT_FILE_OPTION=
1820

@@ -51,6 +53,12 @@ ifneq ("${PHPCS_REPORT_FILE}","")
5153
PHPCS_REPORT_FILE_OPTION ?= --report-file=${PHPCS_REPORT_FILE}
5254
endif
5355

56+
ifneq ("${PHPCS_DISABLE_WARNING}","true")
57+
PHPCS_DISABLE_WARNING_OPTION=
58+
else
59+
PHPCS_DISABLE_WARNING_OPTION=-n
60+
endif
61+
5462

5563
## Project build (install and configure)
5664
build: install configure
@@ -76,20 +84,26 @@ test-functional:
7684
./vendor/bin/behat ${BEHAT_COLOR_OPTION} ${BEHAT_OUTPUT_STYLE_OPTION} --no-snippets
7785

7886
codestyle: create-reports-directory
79-
./vendor/bin/phpcs --standard=phpcs.xml.dist ${PHPCS_COLOR_OPTION} ${PHPCS_REPORT_FILE_OPTION} --report=${PHPCS_REPORT_STYLE}
87+
./vendor/bin/phpcs ${PHPCS_DISABLE_WARNING_OPTION} --standard=phpcs.xml.dist ${PHPCS_COLOR_OPTION} ${PHPCS_REPORT_FILE_OPTION} --report=${PHPCS_REPORT_STYLE}
8088

8189
coverage: create-coverage-directory
8290
./vendor/bin/phpunit ${PHPUNIT_COLOR_OPTION} ${PHPUNIT_OUTPUT_STYLE_OPTION} ${PHPUNIT_COVERAGE_OPTION}
8391

92+
behat-coverage: create-behat-coverage-directory
93+
composer required leanphp/behat-code-coverage
94+
./vendor/bin/behat ${BEHAT_COLOR_OPTION} ${BEHAT_OUTPUT_STYLE_OPTION} --no-snippets --profile coverage
8495

8596

8697
# Internal commands
8798
create-coverage-directory:
8899
mkdir -p ${COVERAGE_DIRECTORY}
89100

101+
create-behat-coverage-directory:
102+
mkdir -p ${BEHAT_COVERAGE_DIRECTORY}
103+
90104
create-reports-directory:
91105
mkdir -p ${REPORTS_DIRECTORY}
92106

93107

94-
.PHONY: build install configure test test-technical test-functional codestyle coverage create-coverage-directory create-reports-directory
108+
.PHONY: build install configure test test-technical test-functional codestyle coverage behat-coverage create-coverage-directory create-behat-coverage-directory create-reports-directory
95109
.DEFAULT: build

behat.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,17 @@ default:
33
default:
44
contexts:
55
- Tests\Functional\BehatContext\DemoAppContext: ~
6+
coverage:
7+
extensions:
8+
LeanPHP\Behat\CodeCoverage\Extension:
9+
drivers:
10+
- local
11+
filter:
12+
whitelist:
13+
include:
14+
directories:
15+
'src': ~
16+
report:
17+
format: html
18+
options:
19+
target: build/behat-coverage

features/bootstrap/DemoAppContext.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,6 @@ class DemoAppContext extends AbstractContext
2020
/** @var bool */
2121
private $useKernelWithDocCreatedListener = false;
2222

23-
/**
24-
* @Given I will use kernel with MethodDocCreated listener
25-
*/
26-
public function givenIWillUseMethodDocCreatedListener()
27-
{
28-
$this->useKernelWithMethodDocCreatedListener = true;
29-
}
30-
3123
/**
3224
* @Given I will use kernel with DocCreated listener
3325
*/

features/demo_app/config_with_doc_created_listener/services.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ services:
99
# Alias resolver mock to bundle resolver
1010
json_rpc_http_server.alias.method_resolver: '@resolver'
1111

12-
# MethodDocCreated Listener
12+
# DocCreated Listener
1313
method_doc_created.listener:
1414
class: DemoApp\Listener\DocCreatedListener
1515
tags:

features/demo_app/src/Method/MethodA.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55

66
class MethodA implements JsonRpcMethodInterface
77
{
8-
/**
9-
* {@inheritdoc}
10-
*/
11-
public function validateParams(array $paramList) : array
12-
{
13-
return [];
14-
}
15-
168
/**
179
* {@inheritdoc}
1810
*/

features/demo_app/src/Method/MethodB.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55

66
class MethodB implements JsonRpcMethodInterface
77
{
8-
/**
9-
* {@inheritdoc}
10-
*/
11-
public function validateParams(array $paramList) : array
12-
{
13-
return [];
14-
}
15-
168
/**
179
* {@inheritdoc}
1810
*/

src/Provider/DocProvider.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ public function __construct(
3535
}
3636

3737
/**
38-
* @param string|null $host
38+
* @param null $host
3939
*
4040
* @return array
41+
*
42+
* @throws \ReflectionException
4143
*/
4244
public function getDoc($host = null) : array
4345
{

tests/Functional/DependencyInjection/ConfigFilesTest.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
use Yoanm\JsonRpcHttpServerSwaggerDoc\App\Normalizer\Component\OperationDocNormalizer;
88
use Yoanm\JsonRpcHttpServerSwaggerDoc\App\Normalizer\Component\RequestDocNormalizer;
99
use Yoanm\JsonRpcHttpServerSwaggerDoc\App\Normalizer\Component\ResponseDocNormalizer;
10-
use Yoanm\JsonRpcHttpServerSwaggerDoc\App\Normalizer\Component\SchemaTypeNormalizer;
1110
use Yoanm\JsonRpcHttpServerSwaggerDoc\App\Normalizer\Component\ShapeNormalizer;
1211
use Yoanm\JsonRpcHttpServerSwaggerDoc\App\Resolver\DefinitionRefResolver;
1312
use Yoanm\JsonRpcHttpServerSwaggerDoc\Infra\Normalizer\DocNormalizer;

0 commit comments

Comments
 (0)