The Principle of least action for test particles in a four-dimensional spacetime embedded in 5D