Backporting tests from doctrine/instantiator#4

See doctrine/instantiator#4