tests/Events/EventEmitterTest.php
/**
     * Tests that callbacks are provided arguments of various types exactly as sent from the emitter.
     */
Tests that callbacks are provided arguments of various types exactly as sent from the emitter.
Tests that callbacks are provided arguments of various types exactly as sent from the emitter .
public function testCallbackArguments()
    {
        $emitter = new EventEmitterHelper();
        $results = array();
        $emitter->once('test', function() use (&$results) {
            $results = func_get_args();
        });
        $emitter->callWithArguments();
        $this->assertEquals(true, $results[0], 'Callback arguments not working properly');
        $this->assertEquals(false, $results[1], 'Callback arguments not working properly');
        $this->assertEquals(0, $results[2], 'Callback arguments not working properly');
        $this->assertEquals(100, $results[3], 'Callback arguments not working properly');
        $this->assertEquals('Hello, world.', $results[4], 'Callback arguments not working properly');
    }
public function testCallbackArguments ( ) { $ emitter = new EventEmitterHelper ( ) ; $ results = array ( ) ; $ emitter -> once ( 'test' , function ( ) use ( & $ results ) { $ results = func_get_args ( ) ; } ) ; $ emitter -> callWithArguments ( ) ; $ this -> assertEquals ( true , $ results [ 0 ] , 'Callback arguments not working properly' ) ; $ this -> assertEquals ( false , $ results [ 1 ] , 'Callback arguments not working properly' ) ; $ this -> assertEquals ( 0 , $ results [ 2 ] , 'Callback arguments not working properly' ) ; $ this -> assertEquals ( 100 , $ results [ 3 ] , 'Callback arguments not working properly' ) ; $ this -> assertEquals ( 'Hello, world.' , $ results [ 4 ] , 'Callback arguments not working properly' ) ; }
Tests that callbacks are provided arguments of various types exactly as sent from the emitter.
Tests that callbacks are provided arguments of various types exactly as sent from the emitter .
// Counter function // Emit twice // Test