2
2
namespace Tests \Functional \BehatContext ;
3
3
4
4
use Behat \Gherkin \Node \PyStringNode ;
5
+ use DemoApp \AbstractKernel ;
6
+ use DemoApp \DefaultKernel ;
7
+ use DemoApp \KernelWithMappingCollectorListener ;
5
8
use PHPUnit \Framework \Assert ;
6
9
use Symfony \Component \HttpFoundation \Response ;
7
10
use Yoanm \JsonRpcServer \Domain \JsonRpcMethodInterface ;
@@ -13,6 +16,16 @@ class DemoAppContext extends AbstractContext
13
16
{
14
17
/** @var Response|null */
15
18
private $ lastResponse ;
19
+ /** @var bool */
20
+ private $ useKernelWithMappingCollectorListener = false ;
21
+
22
+ /**
23
+ * @Given I will use kernel with MappingCollector listener
24
+ */
25
+ public function givenIWillUseServerDocCreatedListener ()
26
+ {
27
+ $ this ->useKernelWithMappingCollectorListener = true ;
28
+ }
16
29
17
30
/**
18
31
* @When I send following :httpMethod input on :uri demoApp kernel endpoint:
@@ -69,4 +82,20 @@ public function thenCollectorShouldHaveAMethodWithName($methodClass, $methodName
69
82
sprintf ('Method "%s" is not an instance of "%s" ' , $ methodName , $ methodClass )
70
83
);
71
84
}
85
+ /**
86
+ * @return AbstractKernel
87
+ */
88
+ public function getDemoAppKernel ()
89
+ {
90
+ $ env = 'prod ' ;
91
+ $ debug = true ;
92
+
93
+ if (true === $ this ->useKernelWithMappingCollectorListener ) {
94
+ $ kernelClass = KernelWithMappingCollectorListener::class;
95
+ } else {
96
+ $ kernelClass = DefaultKernel::class;
97
+ }
98
+
99
+ return new $ kernelClass ($ env , $ debug );
100
+ }
72
101
}
0 commit comments