Added ->extend() and a phpunit test for it