'Unit/integration testing helper: Registers a
:term:`subscriber` which listens for events of the type
``event_iface``.  This method returns a list object which is
appended to by the subscriber whenever an event is captured.
When an event is dispatched that matches the value implied by
the ``event_iface`` argument, that event will be appended to
the list.  You can then compare the values in the list to
expected event notifications.  This method is useful when
testing code that wants to call
:meth:`pyramid.registry.Registry.notify`,
or :func:`zope.component.event.dispatch`.
The default value of ``event_iface`` (``None``) implies a
subscriber registered for *any* kind of event.'

@action_method
def testing_add_subscriber(self, event_iface=None):

    event_iface = self.maybe_dotted(event_iface)
    L = []
    def subscriber(*event):
        L.extend(event)
    self.add_subscriber(subscriber, event_iface)
    return L
