12
12
declare (strict_types=1 );
13
13
14
14
use ApiPlatform \Core \Tests \Fixtures \DummyMercurePublisher ;
15
+ use Behat \Behat \Context \Context ;
15
16
use Behat \Gherkin \Node \PyStringNode ;
16
- use Behat \Symfony2Extension \Context \KernelAwareContext ;
17
- use Symfony \Component \HttpKernel \KernelInterface ;
18
17
use Symfony \Component \Mercure \Update ;
19
18
20
19
/**
21
20
* Context for Mercure.
22
21
*
23
22
* @author Alan Poulain <[email protected] >
24
23
*/
25
- final class MercureContext implements KernelAwareContext
24
+ final class MercureContext implements Context
26
25
{
27
- private $ kernel ;
26
+ private $ publisher ;
28
27
29
- public function setKernel ( KernelInterface $ kernel ): void
28
+ public function __construct ( DummyMercurePublisher $ publisher )
30
29
{
31
- $ this ->kernel = $ kernel ;
30
+ $ this ->publisher = $ publisher ;
32
31
}
33
32
34
33
/**
@@ -38,11 +37,9 @@ public function theFollowingMercureUpdateShouldHaveBeenSent(string $topics, PySt
38
37
{
39
38
$ topics = explode (', ' , $ topics );
40
39
$ update = json_decode ($ update ->getRaw (), true );
41
- /** @var DummyMercurePublisher $publisher */
42
- $ publisher = $ this ->kernel ->getContainer ()->get ('mercure.hub.default.publisher ' );
43
40
44
41
/** @var Update $sentUpdate */
45
- foreach ($ publisher ->getUpdates () as $ sentUpdate ) {
42
+ foreach ($ this -> publisher ->getUpdates () as $ sentUpdate ) {
46
43
$ toMatchTopics = count ($ topics );
47
44
foreach ($ sentUpdate ->getTopics () as $ sentTopic ) {
48
45
foreach ($ topics as $ topic ) {
0 commit comments