I've never heard this phrase before, but it seems to be an accurate one. Hope is defined as "to cherish a desire with anticipation," and this would certainly apply to the dog who hears the refrigerator door open. Dogs are intelligent enough to realize that human food is kept in the refrigerator, so they can anticipate the prospect of the possibility of leftovers or a snack when their human masters open the door. Since one of the main goals in a dog's life seems to be eating whatever it can get its teeth into, a refrigerator is one of great curiosity to the animal. Even if the human does not intend to feed the dog with what's inside, there is always hope.
Have you ever seen a dog near the dinner table? The refrigerator would be a similar scenario for a dog who has spent enough time learning where the food comes from. The interesting thing might be that a dog has been trained to learn that it is possible to get food from a human if the refrigerator door opens. That means a human has given food directly from the fridge before.
The dog experiences great anticipation that there is a possibility food will be for him even if the human doesn't intend to distribute food to the dog at that time. The dog will still wag its tail, salivate, and hope that if it keeps those "puppy dog eyes" it will get what it hopes for.
When a dog hears the refrigerator door open (or the can opener going, or the car keys jingling) it tends to hope that there is about to be something it likes. It hopes it will get fed or it will go for a ride.
Hope is like that. It is something that makes us think that maybe we are going to have something good happen to us whenever we hear (or otherwise sense) something that could possibly mean that.
So hope is like the dog's ear -- it perks up whenever it is given the slightest reason to do so.
First of all the phrase is a Simile, comparing hope to the action of a dog when it anticipates what will be coming out of that refridgerator once it opens. The phrase is essentially comparing how we (humans) dogs etc anticipate, yearn, hope for something in life. When a dog hears the refrigerator door opening, its ears perk up, mouth begins to salivate, and its eyes are wide with expectation. It is the same basic manner in which humans act in anticipating, yearning for something.