本文整理汇总了PHP中Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator::close方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendDecorator::close方法的具体用法?PHP BackendDecorator::close怎么用?PHP BackendDecorator::close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator
的用法示例。
在下文中一共展示了BackendDecorator::close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: persist
/**
* Post request for creating widget instance.
*
* @param FixtureInterface $fixture [optional]
* @throws \Exception
* @return array
*/
public function persist(FixtureInterface $fixture = null)
{
$data = $this->prepareData($fixture);
$url = $_ENV['app_backend_url'] . 'widget_instance/save/type/' . $data['type'] . '/package/' . $this->prepareTheme($data['package_theme']);
if (isset($data['page_id'])) {
$data['parameters']['page_id'] = $data['page_id'][0];
unset($data['page_id']);
}
if ($fixture->hasData('store_ids')) {
$stores = $fixture->getDataFieldConfig('store_ids')['source']->getStores();
foreach ($stores as $store) {
$data['store_ids'][] = $store->getStoreId();
}
}
$data['parameters']['unique_id'] = isset($data['parameters']['unique_id']) ? uniqid() : '';
unset($data['type']);
unset($data['package_theme']);
$curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
$curl->write(CurlInterface::POST, $url, '1.1', [], $data);
$response = $curl->read();
$curl->close();
if (!strpos($response, 'class="success-msg"')) {
throw new \Exception("Widget instance creation by curl handler was not successful! Response: {$response}");
}
$id = $this->getWidgetId($response);
return ['id' => $id];
}
示例2: persist
/**
* Post request for creating sales rule.
*
* @param FixtureInterface $fixture
* @return array
* @throws \Exception
*/
public function persist(FixtureInterface $fixture = null)
{
$this->mapTypeParams = array_merge($this->mapTypeParams, $this->additionalMapTypeParams);
$url = $_ENV['app_backend_url'] . 'sales_rule/promo_quote/save/';
$data = $this->replaceMappingData($fixture->getData());
$data['rule'] = [];
if (isset($data['conditions_serialized'])) {
$data['rule']['conditions'] = $this->prepareCondition($data['conditions_serialized']);
unset($data['conditions_serialized']);
}
$data['website_ids'] = $this->prepareWebsites($data);
$data['customer_group_ids'] = $this->prepareCustomerGroup($data);
if (isset($data['actions_serialized'])) {
$this->mapTypeParams['Conditions combination']['type'] = 'Magento\\SalesRule\\Model\\Rule\\Condition\\Product\\Combine';
$data['rule']['actions'] = $this->prepareCondition($data['actions_serialized']);
unset($data['actions_serialized']);
}
$curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
$curl->write(CurlInterface::POST, $url, '1.0', [], $data);
$response = $curl->read();
$curl->close();
if (!strpos($response, 'data-ui-id="messages-message-success"')) {
throw new \Exception("Sales rule entity creating by curl handler was not successful! Response: {$response}");
}
preg_match('`<tr.*title=".*sales_rule\\/promo_quote\\/edit\\/id\\/([\\d]+)`ims', $response, $matches);
if (empty($matches)) {
throw new \Exception('Cannot find Sales Rule id');
}
return ['id' => $matches[1]];
}
示例3: getRateId
/**
* Get Reward exchange rate id.
*
* @return string|null
*/
protected function getRateId()
{
$url = $_ENV['app_backend_url'] . 'reward_rate/index/sort/rate_id/dir/desc/';
$curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
$curl->write(CurlInterface::GET, $url, '1.0');
$response = $curl->read();
$curl->close();
preg_match('@rate_id/(\\d+)@', $response, $match);
return empty($match[1]) ? null : $match[1];
}
示例4: persist
/**
* Post request for creating currency symbol
*
* @param FixtureInterface $fixture
* @return void
*/
public function persist(FixtureInterface $fixture = null)
{
$data = $fixture->getData();
$url = $_ENV['app_backend_url'] . 'admin/system_currencysymbol/save';
$curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
$curl->write(CurlInterface::POST, $url, '1.0', [], $data);
$curl->read();
$curl->close();
// Response verification is absent, because sending a post request returns an index page
}
示例5: getCustomerGroupId
/**
* Get id after creating Customer Group.
*
* @param array $data
* @return string|null
*/
public function getCustomerGroupId(array $data)
{
$regExp = '/.*id\\/(\\d+)\\/.*' . $data['code'] . '/siu';
$url = $_ENV['app_backend_url'] . 'customer_group/index/sort/time/dir/desc/';
$curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
$curl->write(CurlInterface::GET, $url, '1.1');
$response = $curl->read();
$curl->close();
preg_match($regExp, $response, $matches);
return empty($matches[1]) ? null : $matches[1];
}
示例6: persist
/**
* Post request for creating Event.
*
* @param FixtureInterface $fixture
* @return array
*/
public function persist(FixtureInterface $fixture = null)
{
$data = $this->prepareData($fixture);
$url = $_ENV['app_backend_url'] . 'catalog_event/save/category_id/' . $data['categoryId'] . '/category/';
$curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
$curl->write(CurlInterface::POST, $url, '1.1', [], $data['data']);
$response = $curl->read();
$curl->close();
$id = $this->getCatalogEventId($response);
return ['id' => $id];
}
示例7: getBlockId
/**
* Getting block id by name.
*
* @param string $landingName
* @return int|null
*/
protected function getBlockId($landingName)
{
$url = $_ENV['app_backend_url'] . 'catalog/category';
$curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
$curl->write(CurlInterface::POST, $url, '1.0', [], []);
$response = $curl->read();
$curl->close();
preg_match('~<option.*value="(\\d+)".*>' . preg_quote($landingName) . '</option>~', $response, $matches);
$id = isset($matches[1]) ? (int) $matches[1] : null;
return $id;
}
示例8: getId
/**
* Get created user id.
*
* @return string
*/
protected function getId()
{
$url = $_ENV['app_backend_url'] . 'permissions_user/roleGrid/sort/user_id/dir/desc/';
$curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
$curl->addOption(CURLOPT_HEADER, 1);
$curl->write(CurlInterface::POST, $url, '1.0');
$response = $curl->read();
$curl->close();
preg_match('@edit/user_id/(\\d+)/@siu', $response, $matches);
return $matches[1];
}
示例9: persist
/**
* Post request for creating reward points.
*
* @param FixtureInterface $fixture
* @return void
* @throws \Exception
*/
public function persist(FixtureInterface $fixture = null)
{
$url = $_ENV['app_backend_url'] . 'customer/save/back/edit/tab/customer_info_tabs_customer_edit_tab_reward/';
$curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
$curl->write(CurlInterface::POST, $url, '1.1', [], $this->prepareData($fixture));
$response = $curl->read();
$curl->close();
if (!strpos($response, 'class="success-msg"')) {
throw new \Exception("Adding reward points by curl handler was not successful! Response: {$response}");
}
}
示例10: persist
/**
* Post request for creating tax class.
*
* @param FixtureInterface $fixture [optional]
* @return mixed|string
*/
public function persist(FixtureInterface $fixture = null)
{
$data = $fixture->getData();
$url = $_ENV['app_backend_url'] . 'tax/tax/ajaxSave/?isAjax=true';
$curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
$curl->write($url, $data);
$response = $curl->read();
$curl->close();
$id = $this->getClassId($response);
return ['id' => $id];
}
示例11: persist
/**
* Post request for creating url rewrite
*
* @param FixtureInterface $fixture
* @throws \Exception
* @return void
*/
public function persist(FixtureInterface $fixture = null)
{
$url = $_ENV['app_backend_url'] . $this->url . $fixture->getTargetPath();
$data = $this->replaceMappingData($fixture->getData());
$curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
$curl->write(CurlInterface::POST, $url, '1.0', [], $data);
$response = $curl->read();
if (!strpos($response, 'data-ui-id="messages-message-success"')) {
throw new \Exception("URL Rewrite creation by curl handler was not successful! Response: {$response}");
}
$curl->close();
}
示例12: persist
/**
* Execute handler
*
* @param FixtureInterface $fixture [optional]
* @return mixed
*/
public function persist(FixtureInterface $fixture = null)
{
/** @var \Magento\Customer\Test\Fixture\CustomerGroup $fixture*/
$params = $this->prepareData($fixture);
$url = $_ENV['app_backend_url'] . $this->saveUrl;
$curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
$curl->addOption(CURLOPT_HEADER, 1);
$curl->write(CurlInterface::POST, $url, '1.0', [], $params);
$response = $curl->read();
$curl->close();
return $this->findId($response, $fixture->getGroupName());
}
示例13: persist
/**
* @param FixtureInterface $fixture [optional]
* @throws \Exception
* @return mixed|void
*/
public function persist(FixtureInterface $fixture = null)
{
$url = $_ENV['app_backend_url'] . $this->url;
$data = $this->replaceMappingData($fixture->getData());
$curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
$curl->write($url, $data);
$response = $curl->read();
if (!strpos($response, 'data-ui-id="messages-message-success"')) {
throw new \Exception("Newsletter template creation by curl was not successful! Response: {$response}");
}
$curl->close();
}
示例14: persist
/**
* Post request for setting currency rate.
*
* @param FixtureInterface $fixture [optional]
* @return mixed|string
* @throws \Exception
*/
public function persist(FixtureInterface $fixture = null)
{
$data = $this->prepareData($fixture);
$url = $_ENV['app_backend_url'] . 'admin/system_currency/saveRates/';
$curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
$curl->write(CurlInterface::POST, $url, '1.0', [], $data);
$response = $curl->read();
$curl->close();
if (!strpos($response, 'data-ui-id="messages-message-success"')) {
throw new \Exception("Currency rates setting by curl handler was not successful! Response:\n" . $response);
}
}
示例15: getNewSearchTermId
/**
* Getting search term id.
*
* @param string $queryText
* @return int
* @throws \Exception
*/
protected function getNewSearchTermId($queryText)
{
$filter = base64_encode('search_query=' . $queryText);
$url = $_ENV['app_backend_url'] . $this->url . 'index/filter/' . $filter;
$curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
$curl->write($url, [], CurlInterface::GET);
$response = $curl->read();
$curl->close();
if (!preg_match('#' . $this->url . 'edit/id/(\\d+)/"#', $response, $matches)) {
throw new \Exception('Search term not found in grid!');
}
return (int) $matches[1];
}