tests/Events/EventEmitterTest.php
/**
     * Tests that a callback, when removed, is not executed further.
     */
Tests that a callback, when removed, is not executed further.
Tests that a callback when removed is not executed further .
public function testRemoveCallback()
    {
        $emitter = new EventEmitterHelper();
        $i = 0;
        $callback = (function() use (&$i) {
            $i++;
        });
        $emitter->once('test', $callback);
        $emitter->remove('test', $callback);
        $emitter->call();
        $this->assertEquals(0, $i, 'Callback was executed after being removed.');
    }
public function testRemoveCallback ( ) { $ emitter = new EventEmitterHelper ( ) ; $ i = 0 ; $ callback = ( function ( ) use ( & $ i ) { $ i ++ ; } ) ; $ emitter -> once ( 'test' , $ callback ) ; $ emitter -> remove ( 'test' , $ callback ) ; $ emitter -> call ( ) ; $ this -> assertEquals ( 0 , $ i , 'Callback was executed after being removed.' ) ; }
Tests that a callback, when removed, is not executed further.
Tests that a callback when removed is not executed further .
// Callback // Bind callback // Remove callback // Emit // Test