コード例 #1
0
 /**
  * @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);
 }
コード例 #2
0
ファイル: WebApiContext.php プロジェクト: drymek/fcs-backend
 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);
 }
コード例 #3
0
 /**
  * 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);
 }