Implementing a new event system

This is https://github.com/joomla/joomla-platform/pull/1621.

I added unit tests and changed some things.

Resume : 
-----------

All event listeners must take a `JEvent` object as sole parameter.


```php
<?php

class Listener
{
    public function onBeforeSomething(JEvent $event)
    {

    }

    public function onAfterSomething(JEvent $event)
    {

    }
}

$dispatcher = JEventDispatcher::getInstance();

// The listener is registered to events
// corresponding to it's method names.
$dispatcher->registerListener(new Listener);

// The listener can be registered only
// to some specific events.
$dispatcher->registerListener(
    new Listener, 
    array('onBeforeSomething')
);

/** 
 *  The listener can be registered to
 *  some events with a given priority.
 *  The default priority is 0.
 *  If some listeners have the same priority,
 *  they will be called in the order they were
 *  registered.
 **/
$dispatcher->registerListener(
    new Listener, 
    array()
    array('onBeforeSomething' => 4)
);
```

Closures

```php
<?php

$listener = function(JEvent $event) {
};

$dispatcher = JEventDispatcher::getInstance();

// Closure listeners must be explicitly
// registered to a given event (or more)
$dispatcher->registerListener(
    $listener, 
    array('onBeforeSomething')
);

// Specifying a priority.
$dispatcher->registerListener(
    $listener, 
    array('onBeforeSomething')
    array('onBeforeSomething' => 4)
);
```

Closures and 'normal' objects can be used together in the dispatcher.
Additionnaly, the event propagation can be stopped by a listener.
```php
<?php

class ListenerOne
{
	public function onBeforeSomething(JEvent $event)
	{
		echo 'It is enough for me';

		// Stopping the event propagation.
		$event->stopPropagation();
	}
}

$listenerTwo = function (JEvent $event)
{
	echo 'Please pass me this event!';
};

$dispatcher = JEventDispatcher::getInstance();

$dispatcher->registerListener(new ListenerOne);
$dispatcher->registerListener(
    $listenerTwo,
    array('onBeforeSomething')
);

$dispatcher->triggerEvent('onBeforeSomething');
```

By default a JEvent object is created and passed to the listeners
when triggering the event.
You can inject your custom event object using two methods :

```php
<?php

// Create the onBeforeSomething event with special arguments.
$onBeforeSomething = new JEvent('onBeforeSomething');
$onBeforeSomething->setArgument('foo', 'bar');

$dispatcher = JEventDispatcher::getInstance();

// First method : registering a custom event.
$dispatcher->registerEvent($onBeforeSomething);

// Second method : when triggering the event.
$dispatcher->triggerEvent($onBeforeSomething);