  Compartmental models are the most widely used framework for modeling
infectious diseases. These models have been continuously refined to incorporate
all the realistic mechanisms that can shape the course of an epidemic outbreak.
Building on a compartmental model that accounts for early detection and
isolation of infectious individuals through testing, in this article we focus
on the viability of detection processes under limited availability of testing
resources, and we study how the latter impacts on the detection rate. Our
results show that, in addition to the well-known epidemic transition at
${\mathcal{R}}_0=1$, a second transition occurs at ${\mathcal{R}}^*_0>1$
pinpointing the collapse of the detection system and, as a consequence, the
switch from a regime of mitigation to a regime in which the pathogen spreads
freely. We characterize the epidemic phase diagram of the model as a function
of the relevant control parameters: the basic reproduction number, the maximum
detection capacity of the system, and the fraction of individuals in shelter.
Our analysis thus provides a valuable tool for estimating the detection
resources and the level of confinement needed to face epidemic outbreaks.
