eZ\Publish\Core\SignalSlot\Tests\SignalDispatcher\DefaultSignalDispatcherTest::testEmitSignalMultipleSlots PHP Метод

testEmitSignalMultipleSlots() публичный Метод

    public function testEmitSignalMultipleSlots()
    {
        $signal = $this->getMock('\\eZ\\Publish\\Core\\SignalSlot\\Signal');
        $slot = $this->getMock('\\eZ\\Publish\\Core\\SignalSlot\\Slot');
        $slot->expects($this->once())->method('receive')->with($signal);
        $slot2 = $this->getMock('\\eZ\\Publish\\Core\\SignalSlot\\Slot');
        $slot2->expects($this->once())->method('receive')->with($signal);
        $slot3 = $this->getMock('\\eZ\\Publish\\Core\\SignalSlot\\Slot');
        $slot3->expects($this->once())->method('receive')->with($signal);
        $dispatcher = new SignalSlot\SignalDispatcher\DefaultSignalDispatcher();
        $dispatcher->attach('\\' . get_class($signal), $slot);
        $dispatcher->attach('\\' . get_class($signal), $slot2);
        // Registering a wildcard slot. It is supposed to receive all the signals, whatever they are.
        $dispatcher->attach('*', $slot3);
        $dispatcher->emit($signal);
    }