He asked this only to test him, for he already had in mind what he was going to do. (NIV)
But He said this to prove (test) him, for He well knew what He was about to do. (AMP)
And this he said to prove him: for he himself knew what he would do. (KJV)