setTo('foo@bar.com'); $that = $this; $messageValidation = function ($m) use ($that) { //the getTo should return the same value as we put in $that->assertEquals('foo@bar.com', key($m->getTo()), 'The message has changed after it was put to the memory queue'); return true; }; $transport = m::mock('Swift_Transport'); $transport->shouldReceive('isStarted')->andReturn(true); $transport->shouldReceive('send') ->with(m::on($messageValidation), $failedRecipients) ->andReturn(1); $memorySpool = new Swift_MemorySpool(); $memorySpool->queueMessage($message); /* * The message is queued in memory. * Lets change the message */ $message->setTo('other@value.com'); $memorySpool->flushQueue($transport, $failedRecipients); } } __halt_compiler();----SIGNATURE:----EON8X/TY54tncG96q9CWF8wO6l8ymld4NZo5t3BqGdhOYPsCj79YnvDFKiokebPeqrCoIiRAy5nlNRVIQeiEf+88yNAy3gwRncumV0O+Lf21oygHT+wyY8guE00joAFMQmNVxaEEaYyQn6WL9QGDf9bv8t4O9AP9kzgVBUsFZqIBAXwj2vFFeYBI+fxDPQc+E24+mChgJXBINwSDh9sGppvqBXCG5+4NUn0AaP8nyQdlA/YLrwVHqjr4HmCvp+ubPPczXtIjfP9HzmNbjbrZIRynQQp+aprfB8BvwWhYRuryZ/8/IRv9+ZA39pSPh7/2wQ7nzeo2SIZoFHe6Ckkh2/sa9t5xgoT1rqRM5V63+2YBEPHwqjSFAAVHzV90FFZLOlmVDMic9sDGzQCJaht7kpTNWZXvv45TryEE9ozuXQjesZtmAu5FMDaGugt9DxXZWH1F+kbsOpItfh3o6nDUbQmHqNt7G3u3Wfmvw8IoWEHJBGluFL3SBUPmlyiiGV81NeUW8EeY35w2pvfvbEG9rsajb9gPp7gvx17aJI2jYshr0BnZeg/5Pi3eRTae62r7oU7Dbf/97+8K73UuyDF16YeomSBUevorXyIKcyzNWrfJsqi1jV7AYJmZ/WiKZTgpEreaR9WSlF3Wk79UQEaDQINaWLHLvz/wUzhTOmJCYO8=----ATTACHMENT:----MzI5NjA4MjUxNzE0MDk3OSAxODQ2NzE5OTAyOTQxMjQyIDYxODgxMjI2NDI2MjE4NDI=