Skip to content

Commit 52c799e

Browse files
authored
Add FT (#18)
1 parent 7502d49 commit 52c799e

22 files changed

+2057
-87
lines changed

.scrutinizer.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ build:
1515
tests:
1616
stop_on_failure: true
1717
override:
18-
- php-scrutinizer-run --enable-security-analysis
19-
- make codestyle
2018
-
2119
command: make coverage
2220
idle_timeout: 1200
2321
coverage:
2422
file: 'build/coverage/clover.xml'
2523
format: 'php-clover'
24+
- php-scrutinizer-run --enable-security-analysis
25+
- make codestyle
2626
cache:
2727
directories:
2828
- ~/.composer
@@ -35,7 +35,6 @@ build:
3535
COMPOSER_OPTIONS: '--optimize-autoloader'
3636
COVERAGE_OUTPUT_STYLE: 'clover'
3737
COVERAGE_CLOVER_FILE_PATH: 'build/coverage/clover.xml'
38-
PHPCS_DISABLE_WARNING: "true"
3938
php:
4039
version: "7.1"
4140
timezone: UTC

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
language: php
22

33
php:
4-
- '7.0'
54
- '7.1'
65
- '7.2'
6+
- '7.3'
77

88
env:
99
global:
@@ -19,7 +19,7 @@ matrix:
1919

2020
before_install:
2121
# remove xdebug to speed up build
22-
- phpenv config-rm xdebug.ini
22+
- phpenv config-rm xdebug.ini || true
2323

2424
install:
2525
- make build

behat.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ default:
22
suites:
33
default:
44
contexts:
5-
- Tests\Functional\BehatContext\FeatureContext: ~
5+
- Tests\Functional\BehatContext\DocNormalizerContext: ~

composer.json

Lines changed: 35 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
11
{
2-
"name": "yoanm/jsonrpc-http-server-swagger-doc-sdk",
3-
"description": "SDK to generate Http JSON-RPC server documentation for Swagger v2.0",
4-
"license": "MIT",
5-
"type": "library",
6-
"support": {
7-
"issues": "https://github.com/yoanm/php-jsonrpc-http-server-swagger-doc-sdk/issues"
8-
},
9-
"authors": [
10-
{
11-
"name": "Yoanm",
12-
"email": "yoanm@users.noreply.github.com",
13-
"role": "Developer"
14-
}
15-
],
16-
"autoload": {
17-
"psr-4": {
18-
"Yoanm\\JsonRpcHttpServerSwaggerDoc\\": "src"
19-
}
20-
},
21-
"autoload-dev": {
22-
"psr-4": {
23-
"Tests\\": "tests",
24-
"Tests\\Functional\\BehatContext\\": "features/bootstrap"
25-
}
26-
},
27-
"require": {
28-
"php": ">=7.0",
29-
"yoanm/jsonrpc-server-doc-sdk": "dev-release/1.0.0"
30-
},
31-
"require-dev": {
32-
"behat/behat": "~3.0",
33-
"squizlabs/php_codesniffer": "3.*",
34-
"phpunit/phpunit": "^6.0 || ^7.0",
35-
"yoanm/php-unit-extended": "~1.0"
2+
"name": "yoanm/jsonrpc-http-server-swagger-doc-sdk",
3+
"description": "SDK to generate Http JSON-RPC server documentation for Swagger v2.0",
4+
"license": "MIT",
5+
"type": "library",
6+
"support": {
7+
"issues": "https://github.com/yoanm/php-jsonrpc-http-server-swagger-doc-sdk/issues"
8+
},
9+
"authors": [
10+
{
11+
"name": "Yoanm",
12+
"email": "yoanm@users.noreply.github.com",
13+
"role": "Developer"
3614
}
15+
],
16+
"autoload": {
17+
"psr-4": {
18+
"Yoanm\\JsonRpcHttpServerSwaggerDoc\\": "src"
19+
}
20+
},
21+
"autoload-dev": {
22+
"psr-4": {
23+
"Tests\\": "tests",
24+
"Tests\\Functional\\BehatContext\\": "features/bootstrap"
25+
}
26+
},
27+
"require": {
28+
"php": ">=7.1",
29+
"yoanm/jsonrpc-server-doc-sdk": "dev-release/1.0.0"
30+
},
31+
"require-dev": {
32+
"ext-json": "*",
33+
"behat/behat": "~3.0",
34+
"squizlabs/php_codesniffer": "3.*",
35+
"phpunit/phpunit": "^6.0 || ^7.0",
36+
"yoanm/php-unit-extended": "~1.0"
37+
}
3738
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
namespace Tests\Functional\BehatContext;
3+
4+
use Behat\Behat\Context\Context;
5+
6+
class AbstractContext implements Context
7+
{
8+
protected function jsonDecode($encodedData)
9+
{
10+
$decoded = json_decode($encodedData, true);
11+
12+
if (JSON_ERROR_NONE != json_last_error()) {
13+
throw new \Exception(
14+
json_last_error_msg(),
15+
json_last_error()
16+
);
17+
}
18+
19+
return $decoded;
20+
}
21+
22+
/**
23+
* @param object $object
24+
* @param array $decodedMethodCalls
25+
*
26+
* @return mixed
27+
*/
28+
protected function callMethods($object, array $decodedMethodCalls)
29+
{
30+
foreach ($decodedMethodCalls as $decodedMethodCall) {
31+
call_user_func_array(
32+
[$object, $decodedMethodCall['method']],
33+
$decodedMethodCall['arguments'] ?? []
34+
);
35+
}
36+
}
37+
}

0 commit comments

Comments
 (0)