Outdated since PIO core 6.0 came out. Unit testing was massively refactored. Please have a look at the new documentation and simliar topics (CI unit test gtest fail: undefined reference to `pthread_setspecific' - #2 by ivankravets, Pio test broke with esp32doit-devkit-v1 in pio core 6.1, File structure to satisfy both building and testing?).
Your particular
error is because the implementation for the component you want to test is in src/
with the src/LedDiode.cpp
and src/LedDiode.hpp
file. Any sources in src/
are by default not compiled when testing (test_build_src = no
by default). So, you should put those two files in lib/LedDiode
so that unit tests can find them.