The match will be for Fifers forward Kevin Smith, who originally joined the Methil club in January 2014.
The game will take place on Tuesday, July 5 with a 7.45pm kick-off at the Locality Hub Bayview Stadium. Ticket prices are £10 for adults and £5 for concessions.
An East Fife statement read: “The Kevin Smith Testimonial Committee are delighted to confirm that Heart of Midlothian as the opposition for Kevin Smith’s Testimonial match.
Hibs debrief: Alarm bells in the stand (and defence); Tavares decision; ref's big calls
Lee Johnson laments Hibs mentality after hairdryer treatment during Livingston loss
Livingston troll Hibs with 'Choose Livi' Twitter post following 2-1 win
Hibs on the wrong end of astounding statistic after latest defeat at Livingston
Former Hearts striker steps out of 'comfort zone' with move to Turkish top flight
"Please note, no tickets will be printed for this match and turnstiles will be cash only. East Fife TV will also be providing a live stream and details will be announced nearer the time.
“This is your chance to say ‘thank you’ to our outgoing club captain and be directly involved in what are sure to be an unforgettable occasion. All monies raised go to Kevin directly so please attend if you can.”
It was announced earlier this year that Smith would leave East Fife this summer following his eight years of service. Despite him falling short of the 10-year stay which is typically required for a testimonial match, the club saw fit to reward him with one.
Smith, who was born in Edinburgh and grew up supporting Hibs, has been club captain since 2015. He led them to the Scottish League Two title in 2016.
Hearts have played East Fife on five occasions in the last three years during the Betfred Cup group stages, winning two and drawing the other.