Skip to content

Commit 3bdbcde

Browse files
authoredNov 1, 2018
Add FT (#4)
1 parent fc1f781 commit 3bdbcde

11 files changed

+1730
-17
lines changed
 

‎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: ~
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)
Please sign in to comment.