• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP CurlTransport\BackendDecorator类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator的典型用法代码示例。如果您正苦于以下问题:PHP BackendDecorator类的具体用法?PHP BackendDecorator怎么用?PHP BackendDecorator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了BackendDecorator类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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];
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:34,代码来源:Curl.php


示例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]];
 }
开发者ID:opexsw,项目名称:magento2,代码行数:37,代码来源:Curl.php


示例3: 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
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:16,代码来源:Curl.php


示例4: 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];
 }
开发者ID:QiuLihua83,项目名称:magento-ee,代码行数:15,代码来源:Curl.php


示例5: 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}");
     }
 }
开发者ID:MikeTayC,项目名称:magento.dev,代码行数:18,代码来源:Curl.php


示例6: 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];
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:17,代码来源:Curl.php


示例7: 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];
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:16,代码来源:Curl.php


示例8: 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];
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:17,代码来源:Curl.php


示例9: 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];
 }
开发者ID:QiuLihua83,项目名称:magento-ee,代码行数:17,代码来源:Curl.php


示例10: 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;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:17,代码来源:Curl.php


示例11: 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();
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:17,代码来源:Curl.php


示例12: 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();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:19,代码来源:Curl.php


示例13: 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);
     }
 }
开发者ID:opexsw,项目名称:magento2,代码行数:19,代码来源:Curl.php


示例14: 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());
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:18,代码来源:CreateCustomerGroup.php


示例15: persist

 /**
  * Curl creation of User Role.
  *
  * @param FixtureInterface $fixture [optional]
  * @return array
  * @throws \Exception
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $data = $this->prepareData($fixture);
     $url = $_ENV['app_backend_url'] . 'permissions_role/saverole/';
     $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("Role entity creating by curl handler was not successful! Response: {$response}");
     }
     return ['role_id' => $this->getRoleId($response)];
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:20,代码来源:Curl.php


示例16: 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];
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:20,代码来源:Curl.php


示例17: persist

 /**
  * Post request for creating product Rating in backend.
  *
  * @param FixtureInterface|null $rating
  * @return array
  * @throws \Exception
  */
 public function persist(FixtureInterface $rating = null)
 {
     $url = $_ENV['app_backend_url'] . 'rating/save';
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $data = $this->replaceMappingData($this->prepareData($rating->getData()));
     $curl->write(CurlInterface::POST, $url, '1.1', [], $data);
     $response = $curl->read();
     $curl->close();
     if (!strpos($response, 'class="success-msg"')) {
         throw new \Exception('Product Rating entity creating by curl handler was not successful! Response:' . $response);
     }
     return ['rating_id' => $this->getProductRatingId()];
 }
开发者ID:cewolf2002,项目名称:magento,代码行数:20,代码来源:Curl.php


示例18: persist

 /**
  * Post request for creating tax rule
  *
  * @param FixtureInterface $fixture
  * @return mixed|null
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $data = $this->prepareData($fixture);
     $url = $_ENV['app_backend_url'] . 'tax/rule/save/?back=1';
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->addOption(CURLOPT_HEADER, 1);
     $curl->write(CurlInterface::POST, $url, '1.0', [], $data);
     $response = $curl->read();
     $curl->close();
     preg_match("~Location: [^\\s]*\\/rule\\/(\\d+)~", $response, $matches);
     $id = isset($matches[1]) ? $matches[1] : null;
     return ['id' => $id];
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:19,代码来源:Curl.php


示例19: persist

 /**
  * Post request for creating sitemap
  *
  * @param FixtureInterface $fixture
  * @return array
  * @throws \Exception
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $url = $_ENV['app_backend_url'] . 'admin/sitemap/save/generate/';
     $data = array_merge($this->defaultAttributeValues, $fixture->getData());
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->addOption(CURLOPT_HEADER, 1);
     $curl->write($url, $data);
     $response = $curl->read();
     $curl->close();
     if (!strpos($response, 'data-ui-id="messages-message-success"')) {
         throw new \Exception("Sitemap entity creating by curl handler was not successful! Response: {$response}");
     }
     return ['sitemap_id' => $this->getSitemapId($data)];
 }
开发者ID:andrewhowdencom,项目名称:m2onk8s,代码行数:21,代码来源:Curl.php


示例20: persist

 /**
  * Post request for creating product Review in backend
  *
  * @param FixtureInterface|null $review [optional]
  * @return array
  * @throws \Exception
  */
 public function persist(FixtureInterface $review = null)
 {
     /** @var Review $review */
     $url = $_ENV['app_backend_url'] . 'review/product/post/';
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $data = $this->replaceMappingData($this->getPreparedData($review));
     $curl->write($url, $data);
     $response = $curl->read();
     $curl->close();
     if (!strpos($response, 'data-ui-id="messages-message-success"')) {
         throw new \Exception('Product Review entity creating by curl handler was not successful! Response:' . $response);
     }
     return ['review_id' => $this->getReviewId()];
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:21,代码来源:Curl.php



注:本文中的Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Model\Config类代码示例发布时间:2022-05-23
下一篇:
PHP Fixture\InjectableFixture类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap