Fixed #23768 -- Rewrote template tests as unit tests

It seems we can probably move deprecation warning handling to the actual test cases now. We can make it a follow-up item after merging the first version of this if you like.