tests/Events/EventEmitterTest.php
/**
     * Tests that a recurrent callback runs each time it is invoked.
     */
Tests that a recurrent callback runs each time it is invoked.
Tests that a recurrent callback runs each time it is invoked .
public function testMultiOccurrenceEvent()
    {
        $emitter = new EventEmitterHelper();
        $i = 0;
        $emitter->on('test', function() use (&$i) {
            $i++;
        });
        $emitter->call();
        $emitter->call();
        $this->assertEquals(2, $i, 'Callback was not executed twice.');
    }
public function testMultiOccurrenceEvent ( ) { $ emitter = new EventEmitterHelper ( ) ; $ i = 0 ; $ emitter -> on ( 'test' , function ( ) use ( & $ i ) { $ i ++ ; } ) ; $ emitter -> call ( ) ; $ emitter -> call ( ) ; $ this -> assertEquals ( 2 , $ i , 'Callback was not executed twice.' ) ; }
Tests that a recurrent callback runs each time it is invoked.
Tests that a recurrent callback runs each time it is invoked .
// Counter function // Emit twice // Test