/**
  * @expectedException Exception
  */
 public function test_typecasting_method_with_condition_with_all_params_but_wrong()
 {
     $obj = new IntegrationTest_TestClass();
     $inj = new \PhpInjector\Injector(array($obj, 'IntegrationTest_typecasting_function_with_conditions'));
     $ret = $inj->invoke(array('b' => '12345', 'a' => null, 'd' => null, 'c' => null));
     $this->assertSame(array(1, '12345', null, null), $ret);
 }
Пример #2
0
 public function test_InvokeWithFunction()
 {
     $inj = new \PhpInjector\Injector('myFancyFunctionUnderTest');
     $ret = $inj->invoke(array('dee' => 'ddd', 'b' => 'bbb', 'cee' => '55', 'a' => 'aaa'));
     $this->assertSame(array('a' => 'aaa', 'b' => 'bbb', 'cee' => 55, 'dee' => 'ddd'), $ret);
     $ret = $inj->invoke(array('b' => 'bbb', 'a' => 'aaa'));
     $this->assertSame(array('a' => 'aaa', 'b' => 'bbb', 'cee' => 5, 'dee' => 'hello'), $ret);
 }