'If more than one trigger added to the C{\'before\'} phase of an event
return L{Deferred}s, the C{\'during\'} phase should be delayed until they
are all called back.'

def test_multipleBeforeReturnDeferred(self):

    firstDeferred = Deferred()
    secondDeferred = Deferred()
    eventType = 'test'
    events = []
    def firstBeforeTrigger():
        return firstDeferred
    def secondBeforeTrigger():
        return secondDeferred
    def duringTrigger():
        events.append('during')
    self.addTrigger('before', eventType, firstBeforeTrigger)
    self.addTrigger('before', eventType, secondBeforeTrigger)
    self.addTrigger('during', eventType, duringTrigger)
    self.assertEqual(events, [])
    reactor.fireSystemEvent(eventType)
    self.assertEqual(events, [])
    firstDeferred.callback(None)
    self.assertEqual(events, [])
    secondDeferred.callback(None)
    self.assertEqual(events, ['during'])
