Once the three of the thirty chiefs went down and came to David at the cave of Adullam during the harvest, while a troop of Philistines was camping in the Valley of Rephaim.
So David inquired of God, asking, “Should I go up against the Philistines? Will You give them over into my hand?” Then Adonai said to him, “Go up! I will give them over into your hand.”
When the Philistines heard that David was anointed king over all Israel, all the Philistines went up in search of David, but David heard of it and went out before them.