/** * @Given I am a user :username with password :password and role :role */ public function iAmAUserWithPasswordAndRole($username, $password, $role) { $account = $this->objectManager->get('TYPO3\\Flow\\Security\\AccountFactory')->createAccountWithPassword($username, $password, array('T3DD.Backend:' . $role), 'HttpBasic'); $person = new \TYPO3\Party\Domain\Model\Person(); $person->setName(new \TYPO3\Party\Domain\Model\PersonName('', '', '', '', ucfirst($username))); $this->objectManager->get('TYPO3\\Party\\Domain\\Repository\\PartyRepository')->add($person); $account->setParty($person); $this->objectManager->get('TYPO3\\Flow\\Security\\AccountRepository')->add($account); $this->flowContext->persistAll(); $this->webApiContext->iAmAuthenticatingAs($username, $password); }
public function iSendARequestWithFormData($method, $url, PyStringNode $body) { $token = $this->getParameterBag()->get('token'); $this->addHeader('Authorization', 'Bearer ' . $token); parent::iSendARequestWithFormData($method, $url, $body); $this->getParameterBag()->set('response', $this->response); }
/** * Sets place holder for replacement. * * you can specify placeholders, which will * be replaced in URL, request or response body. * * The key will be surrounded by "<" and ">" characters * * @param string $key token name * @param string $value replace value */ public function setPlaceHolder($key, $value) { parent::setPlaceHolder("<{$key}>", $value); }