Display the drop-down list

Test of call_user_func()

Example #1 : test success
Example #2 : test success
Example #3 : test success
Example #4 : test success
Example #5 : test success
Example #6 : test success
Example #7 : test success
Example #8 : test success
Example #9 : test success
Example #10 : test not validated (platform dependant or random result etc.)
Example #11 : test success
Example #12 : test success
Example #13 : test success
Example #14 : test success
Example #15 : test success
Example #16 : test success
Example #1
$input = [
  
=> 'barber',
  
=> 'mushroom',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'mixed' => 'You wanted a mushroom haircut, no problem',
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #2
$input = [
  
=> '$barber',
  
=> 'shave',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'mixed' => 'You wanted a shave haircut, no problem',
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #3
$input = [
  
=> [
    
=> 'myclass',
    
=> 'say_hello',
  ],
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'mixed' => 'Hello!',
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #4
$input = [
  
=> 'myclass::say_hello',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'mixed' => 'Hello!',
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #5
$input = [
  
=> [
    
=> '$object',
    
=> 'say_goodbye',
  ],
  
=> 'Bob',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'mixed' => 'Goodbye Bob!',
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #6
$input = [
  
=> 'foobar',
  
=> 'one',
  
=> 'two',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'mixed' => 'foobar got one and two',
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #7
$input = [
  
=> 'strncmp',
  
=> 'abc',
  
=> 'DEF',
  
=> 3,
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'mixed' => 1,
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #8
$input = [
  
=> '$xyz',
  
=> 'mushroom',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'mixed' => NULL,
  ],
  
'errors' => [
    
=> [
      
'code' => 2,
      
'message' => 'call_user_func() expects parameter 1 to be a valid callback, no array or string given',
    ],
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #9
$input = [
  
=> [
    
=> 'xyz',
    
=> 'say_hello',
  ],
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'mixed' => NULL,
  ],
  
'errors' => [
    
=> [
      
'code' => 2,
      
'message' => 'call_user_func() expects parameter 1 to be a valid callback, class \'xyz\' not found',
    ],
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #10
$input = [
  
=> [
    
=> 'Closure',
    
=> 'bind',
  ],
]
test not validated (platform dependant or random result etc.)
$test_output = [
  
'errors' => [
    
=> [
      
'code' => 512,
      
'message' => 'this class may not be used',
    ],
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #11
$input = [
  
=> 'myclass::xyz',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'mixed' => NULL,
  ],
  
'errors' => [
    
=> [
      
'code' => 2,
      
'message' => 'call_user_func() expects parameter 1 to be a valid callback, class \'pbx_callbacks\' does not have a method \'xyz\'',
    ],
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #12
$input = [
  
=> [
    
=> '$xyz',
    
=> 'say_goodbye',
  ],
  
=> 'Bob',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'mixed' => NULL,
  ],
  
'errors' => [
    
=> [
      
'code' => 2,
      
'message' => 'call_user_func() expects parameter 1 to be a valid callback, first array member is not a valid class name or object',
    ],
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #13
$input = [
  
=> [
    
=> '$xyz',
  ],
  
=> 'Bob',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'mixed' => NULL,
  ],
  
'errors' => [
    
=> [
      
'code' => 2,
      
'message' => 'call_user_func() expects parameter 1 to be a valid callback, array must have exactly two members',
    ],
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #14
$input = [
  
=> [
    
=> '$object',
    
=> 'say_goodbye',
  ],
  
=> 'Bob',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'mixed' => 'Goodbye Bob!',
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #15
$input = [
  
=> '$xyz',
  
=> 'one',
  
=> 'two',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'mixed' => NULL,
  ],
  
'errors' => [
    
=> [
      
'code' => 2,
      
'message' => 'call_user_func() expects parameter 1 to be a valid callback, no array or string given',
    ],
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #16
$input = [
  
=> 'xyz',
  
=> 'abc',
  
=> 'DEF',
  
=> 3,
]
$expected_output = $test_output
$test_output = [
  
'errors' => [
    
=> [
      
'code' => 512,
      
'message' => 'this callback function is invalid or not available on this server',
    ],
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]