/** * Dispatches a soap request via a sfTestBrowser to the tested application. * * @see SoapClient::__doRequest() */ public function __doRequest($request, $location, $action, $version) { $this->lastRequest = strval($request); $GLOBALS['HTTP_RAW_POST_DATA'] = $this->lastRequest; $this->browser->setHttpHeader('soapaction', strval($action)); sfFilter::$filterCalled = array(); $this->lastResponse = strval($this->browser->post('/')->getResponse()->getContent()); return $this->lastResponse; }
/** * If your page triggers an ajax request, you can perform it manually. * This action sends a GET ajax request with specified params. * * See ->sendAjaxPostRequest for examples. * * @param $uri * @param $params */ public function sendAjaxGetRequest($uri, $params) { $this->browser->setHttpHeader('X-Requested-With', 'XMLHttpRequest'); $this->call($uri, 'get', $params); $this->debug($this->browser->getResponse()->getContent()); }
public function login($usr, $pass) { $this->browser->setHttpHeader('Content-Type', 'application/json'); $this->browser->post('login', ['password' => $pass, 'usuario' => $usr]); }
<?php define('MOBILE_USER_AGENT', 'KDDI-CA39 UP.Browser/6.2.0.13.1.5 (FUI) MMP/2.0'); $_SERVER['HTTP_USER_AGENT'] = MOBILE_USER_AGENT; function init() { include dirname(__FILE__) . '/../../bootstrap/functional.php'; include dirname(__FILE__) . '/../../bootstrap/database.php'; } function createUser($mailAddress, $user) { $params = array('authMailAddress' => array('mail_address' => $mailAddress, 'password' => 'password')); $user->post('/member/login/authMode/MailAddress', $params); return $user; } include dirname(__FILE__) . '/../../bootstrap/functional.php'; $browser = new sfBrowser(); $browser->setHttpHeader('User-Agent', MOBILE_USER_AGENT); $user = new sfTestFunctional($browser, new lime_test(null, new lime_output_color())); // create a test user: Mr_OpenPNE init(); $Mr_OpenPNE = createUser('*****@*****.**', $user); $Mr_OpenPNE->info('This is Mr.OpenPNE');