Neos\Flow\Tests\Unit\SignalSlot\DispatcherTest::dispatchThrowsAnExceptionIfTheSpecifiedSlotMethodDoesNotExist PHP Method

dispatchThrowsAnExceptionIfTheSpecifiedSlotMethodDoesNotExist() public method

    public function dispatchThrowsAnExceptionIfTheSpecifiedSlotMethodDoesNotExist()
    {
        $slotClassName = 'Mock_' . md5(uniqid(mt_rand(), true));
        eval('class ' . $slotClassName . ' { function slot($foo, $baz) { $this->arguments = array($foo, $baz); } }');
        $mockSlot = new $slotClassName();
        $mockObjectManager = $this->createMock(ObjectManagerInterface::class);
        $mockObjectManager->expects($this->once())->method('isRegistered')->with($slotClassName)->will($this->returnValue(true));
        $mockObjectManager->expects($this->once())->method('get')->with($slotClassName)->will($this->returnValue($mockSlot));
        $dispatcher = new Dispatcher();
        $dispatcher->injectObjectManager($mockObjectManager);
        $dispatcher->connect('Foo', 'bar', $slotClassName, 'unknownMethodName', true);
        $dispatcher->dispatch('Foo', 'bar', ['foo' => 'bar', 'baz' => 'quux']);
        $this->assertSame($mockSlot->arguments, ['bar', 'quux']);
    }