Statement:
$chain->expects($this->once()) ->method('addMethodCall') ->with( 'addOptionsProvider', array( $this->isInstanceOf('Symfony\Component\DependencyInjection\Reference'), $this->equalTo(7) ) );
$chain is actually a Definition mock object, and this is the code I would like to test:
$definition->addMethodCall( 'addOptionsProvider', array(new Reference($id), $priority) );
I am starting PHPUnit, so I really donβt know what I am missing. I find a statement of arguments that are difficult to understand. I included an image with a visual difference between the statement and the actual parameters.
PHPUnit_Framework_ExpectationFailedException: The wait did not hold for the method name is equal when called 1 time (s) Parameter 1 to call Symfony \ Component \ dependency injection \ Definition :: addMethodCall ('addOptionsProvider', Array (...)) does not match the expected value.

EDIT : in fact, I ended up with this:
$chain->expects($this->once()) ->method('addMethodCall') ->with( $this->identicalTo('addOptionsProvider'), $this->logicalAnd( $this->isType('array'), $this->arrayHasKey(0), $this->arrayHasKey(1) ) );
But I cannot "go" to the array values ββfor further approval!
gremo source share