وَلَقَدْ فَتَنَّا ٱلَّذِينَ مِن قَبْلِهِمْ ۖ فَلَيَعْلَمَنَّ ٱللَّهُ ٱلَّذِينَ صَدَقُوا۟ وَلَيَعْلَمَنَّ ٱلْكَـٰذِبِينَ Qur’an Al-Ankabut (29:3)Walaqad fatann a alla th eena min qablihim falayaAAlamanna All a hu alla th eena s adaqoo walayaAAlamanna alk ath ibeen a
I.e., to others and/or to themselves (see note [7]).
The word "know" is used here more in the sense of testing than of acquiring knowledge. Allah is All-Knowing: He needs no test to increase His own knowledge, but the test is to burn out the dross within ourselves, as explained in the last note.