1

I am using Symfony Messenger and I want to do an integration test on MyHandler.

This is how I proceed and it works very well:

protected function setUp()
{
    $this->handler = new MyHandler()
}


public function testMyHandler()

{
    $message = new MyMessage();

    $handler = $this->handler;
    $handler($message);


    $this->assertItDoesWhatIWant();
}

The thing is, when I try to directly pass my $message into the handler like this:

$message = new MyMessage();

$this->handler($message);

I end up with the following error:

Call to undefined method App\Tests\MyTestClass::handler()

Does someone has an idea of what is happening behind the scenes ?

EtienneG
  • 300
  • 5
  • 14

0 Answers0