These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Eole\Sandstone\Tests\Unit\Websocket; |
||
4 | |||
5 | use Eole\Sandstone\Serializer\ServiceProvider as SerializerServiceProvider; |
||
6 | use Eole\Sandstone\Websocket\Routing\TopicRouter; |
||
7 | use Eole\Sandstone\Websocket\Application as WebsocketApplication; |
||
8 | use Eole\Sandstone\Application; |
||
9 | |||
10 | class ApplicationTest extends \PHPUnit_Framework_TestCase |
||
11 | { |
||
12 | public function testLoadTopicThrowExceptionWhenImplementingTheWrongEventDispatcherInterface() |
||
13 | { |
||
14 | $app = new Application(); |
||
15 | $websocketAppClass = new \ReflectionClass(WebsocketApplication::class); |
||
16 | $method = $websocketAppClass->getMethod('loadTopic'); |
||
17 | $method->setAccessible(true); |
||
18 | $websocketApp = $websocketAppClass->newInstance($app); |
||
19 | |||
20 | $app->register(new SerializerServiceProvider()); |
||
21 | |||
22 | $app['sandstone.websocket.router'] = function () { |
||
23 | $wrongTopic = new WrongTopic('my-topic'); |
||
24 | $topicRouterMock = $this->getMockBuilder(TopicRouter::class)->disableOriginalConstructor()->getMock(); |
||
25 | |||
26 | $topicRouterMock |
||
27 | ->method('loadTopic') |
||
28 | ->willReturn($wrongTopic) |
||
29 | ; |
||
30 | |||
31 | return $topicRouterMock; |
||
32 | }; |
||
33 | |||
34 | $this->setExpectedExceptionRegExp( |
||
0 ignored issues
–
show
|
|||
35 | \LogicException::class, |
||
36 | '/WrongTopic seems to implements the wrong EventSubscriberInterface/' |
||
37 | ); |
||
38 | |||
39 | $method->invokeArgs($websocketApp, ['my-topic']); |
||
40 | } |
||
41 | } |
||
42 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.