fix captcha component tests

move the global function in one unique big function that is mock to avoid php failure on the test server