Note that there are some explanatory texts on larger screens.

plurals
  1. POMockery - call_user_func_array() expects parameter 1 to be a valid callback
    primarykey
    data
    text
    <p>I have a class I need to mock:</p> <pre><code>class MessagePublisher { /** * @param \PhpAmqpLib\Message\AMQPMessage $msg * @param string $exchange - if not provided then one passed in constructor is used * @param string $routing_key * @param bool $mandatory * @param bool $immediate * @param null $ticket */ public function publish(AMQPMessage $msg, $exchange = "", $routing_key = "", $mandatory = false, $immediate = false, $ticket = null) { if (empty($exchange)) { $exchange = $this-&gt;exchangeName; } $this-&gt;channel-&gt;basic_publish($msg, $exchange, $routing_key, $mandatory, $immediate, $ticket); } } </code></pre> <p>I am using Mockery 0.7.2</p> <pre><code>$mediaPublisherMock = \Mockery::mock('MessagePublisher') -&gt;shouldReceive('publish') -&gt;withAnyArgs() -&gt;times(3) -&gt;andReturn(null); </code></pre> <p>unfortunately my tests failed, due to this error</p> <blockquote> <p>call_user_func_array() expects parameter 1 to be a valid callback, class 'Mockery\Expectation' does not have a method 'publish' in /vendor/mockery/mockery/library/Mockery/CompositeExpectation.php on line 54</p> </blockquote> <p>I have tried to debug I found that tests fails in this code</p> <pre><code>public function __call($method, array $args) { foreach ($this-&gt;_expectations as $expectation) { call_user_func_array(array($expectation, $method), $args); } return $this; } </code></pre> <p>where<br> $method = 'publish'<br> $args = array()<br> $expectation is instance of Mockery\Expectation object ()</p> <p>I am using php 5.3.10 - any idea what is wrong? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload