XWIKI-9861: NullPointerException on $services.wiki.template.getWikiProvisioningJobStatus().

* Fix the bug and introduce some unit tests.