What "learning an opening" means varies a lot depending on your skill level.
A total beginner may think they've "learned" the Spanish if they know how to get to 1.e4 e5 2.Nf3 Nc6 3.Bb5
A weak-ish amateur will learn a couple of lines against the main responses and be happy with that.
An average club player probably knows the typical middlegame plans that arise from the different liens.
An enthusiastic amateur has probably read several books and memorized many lines or even full games from them. They're fully familiar with the plans/ideas of the middlegame and will know some of them in great detail with lots of examples in mind.
Finally, a professional player will probably not consider they "know" an opening if they haven't prepared some novelty of their own.
In conclusion, learning is a gradual process, so it doesn't make sense to categorize into "I know this opening" and "I don't know this opening". Play, analyze, study and increase the scope of your knowledge bit by bit. There is no a "formal definition" for what learning an opening is because there can't be any useful universal definitions for that.