attach() public method

Attaches the Slot with $slotIdentifier to the signal with $signalIdentifier.
Deprecation: pass signal slots directly to the constructor ({@see \__construct()})
public attach ( string $signalIdentifier, Slot $slot )
$signalIdentifier string
$slot eZ\Publish\Core\SignalSlot\Slot
 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);
 }