Suppose that $\phi$ is a test function on $\mathbb{R}$. Since $\phi$ has compact support, there exists $R>0$ such that $\operatorname{supp} \phi\subseteq [-R,R]$.
The way I understand from this is that $\phi(x)=0$ for all $x\notin [-R,R]$. But what about the endpoints, i.e. $\phi(\pm R)?$
Assume $\phi$ is unequal to $0$ at the endpoints of the interval. W/o loss of generality, we pick $R$ for investigation. Since $\phi$ is a test function it is smooth, therefore it is also continuous. Hence, there exists a small neighborhood around $R$ where $\phi>0$ holds. This, however, contradicts that $supp(\phi)$ is a subset of the interval $[-R,R]$.