/** * @test * @expectedException \OutOfBoundsException * @expectedExceptionMessage You cannot publish a message in the past */ public function it_cannot_publish_a_message_in_the_past() { $message = $this->publisher->createMessage('test'); $this->exchange->shouldReceive('publish')->never(); $this->publisher->publish($message, new \DateTime('-10 minutes')); }