tests/Events/EventEmitterTest.php
/**
     * Tests that a one-time callback runs when invoked.
     */
Tests that a one-time callback runs when invoked.
Tests that a one - time callback runs when invoked .
public function testSingleOccurrenceEvent()
    {
        $emitter = new EventEmitterHelper();
        $i = 0;
        $emitter->once('test', function() use (&$i) {
            $i++;
        });
        $emitter->call();
        $this->assertEquals(1, $i, 'Callback was not executed.');
    }
public function testSingleOccurrenceEvent ( ) { $ emitter = new EventEmitterHelper ( ) ; $ i = 0 ; $ emitter -> once ( 'test' , function ( ) use ( & $ i ) { $ i ++ ; } ) ; $ emitter -> call ( ) ; $ this -> assertEquals ( 1 , $ i , 'Callback was not executed.' ) ; }
Tests that a one-time callback runs when invoked.
Tests that a one - time callback runs when invoked .
// Counter function // Emit // Test