The forward direction is covered in some textbooks. But the reverse I am only able to find sparingly. Is this a counterexample?:
$f=\begin{cases} 0 & (x\not\in\mathbb{Q})\\ 1/n & (x\in\mathbb{Q}) \end{cases}$
where if $x\in\mathbb{Q}$ we write $x=m/n$ such that $n\not| m$. This is the pathological "continuous at irrational points but discontinuous at rational points" which integrates to $0$.
Edit: "some textbooks", maybe not "most"