public function testDeleteFromS3() { $args = ['ReceiptHandle' => $modifiedReceiptHandle = json_encode(['s3_bucket_name' => 'MyBucket', 's3_key' => 'MyKey', 'original_receipt_handle' => 'MyReceiptHandle'])]; $this->sqsClient->method('__call')->with('deleteMessage')->willReturnCallback(function ($name, array $args) use($modifiedReceiptHandle) { $params = array_key_exists(0, $args) ? $args[0] : []; \PHPUnit_Framework_Assert::assertNotEquals($modifiedReceiptHandle, $params['ReceiptHandle']); return new Result(); }); $actual = $this->sut->deleteMessage($args); self::assertInstanceOf(Result::class, $actual); }