當前位置: 首頁>>代碼示例>>PHP>>正文


PHP BackendDecorator::addOption方法代碼示例

本文整理匯總了PHP中Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator::addOption方法的典型用法代碼示例。如果您正苦於以下問題:PHP BackendDecorator::addOption方法的具體用法?PHP BackendDecorator::addOption怎麽用?PHP BackendDecorator::addOption使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator的用法示例。


在下文中一共展示了BackendDecorator::addOption方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: 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

示例2: 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

示例3: 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

示例4: persist

 /**
  * POST request for creating Catalog Price Rule
  *
  * @param FixtureInterface $fixture
  * @return mixed|void
  * @throws \Exception
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $data = $this->prepareData($fixture);
     $url = $_ENV['app_backend_url'] . 'catalog_rule/promo_catalog/save/';
     $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("Catalog Price Rule entity creating by curl handler was not successful! Response: {$response}");
     }
     return ['id' => $this->getCategoryPriceRuleId($data)];
 }
開發者ID:andrewhowdencom,項目名稱:m2onk8s,代碼行數:21,代碼來源:Curl.php

示例5: 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

示例6: createProduct

 /**
  * Create product via curl.
  *
  * @param array $data
  * @param array $config
  * @return array
  * @throws \Exception
  */
 protected function createProduct(array $data, array $config)
 {
     $url = $this->getUrl($config);
     $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"')) {
         $this->_eventManager->dispatchEvent(['curl_failed'], [$response]);
         throw new \Exception('Product creation by curl handler was not successful!');
     }
     return $this->parseResponse($response);
 }
開發者ID:BlackIkeEagle,項目名稱:magento2-continuousphp,代碼行數:22,代碼來源:Curl.php

示例7: setTaxClassId

 /**
  * Set tax class id.
  *
  * @param string $taxClassName
  * @return void
  * @throws \Exception
  */
 protected function setTaxClassId($taxClassName)
 {
     $url = $_ENV['app_backend_url'] . 'tax/rule/new/';
     $config = \Magento\Mtf\ObjectManagerFactory::getObjectManager()->create('Magento\\Mtf\\Config\\DataInterface');
     $curl = new BackendDecorator(new CurlTransport(), $config);
     $curl->addOption(CURLOPT_HEADER, 1);
     $curl->write($url, [], CurlInterface::GET);
     $response = $curl->read();
     $curl->close();
     preg_match('~<option value="(\\d+)".*>' . $taxClassName . '</option>~', $response, $matches);
     if (!isset($matches[1]) || empty($matches[1])) {
         throw new \Exception('Product tax class id ' . $taxClassName . ' undefined!');
     }
     $this->taxClassId = (int) $matches[1];
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:22,代碼來源:TaxClass.php

示例8: persist

 /**
  * Post request for creating tax rule.
  *
  * @param FixtureInterface $fixture [optional]
  * @return array
  * @throws \Exception
  */
 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.1', [], $data);
     $response = $curl->read();
     $curl->close();
     if (!strpos($response, 'success-msg')) {
         throw new \Exception("Tax rule creation by curl handler was not successful!\nResponse:\n{$response}");
     }
     $id = $this->getTaxRuleId($response);
     return ['id' => $id];
 }
開發者ID:cewolf2002,項目名稱:magento,代碼行數:22,代碼來源:Curl.php

示例9: persist

 /**
  * POST request for creating Customer Group.
  *
  * @param FixtureInterface $fixture
  * @return array|mixed
  * @throws \Exception
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $data['code'] = $fixture->getCustomerGroupCode();
     $data['tax_class'] = $fixture->getDataFieldConfig('tax_class_id')['source']->getTaxClass()->getId();
     $url = $_ENV['app_backend_url'] . $this->saveUrl;
     $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("Customer Group entity creating by curl handler was not successful! Response: {$response}");
     }
     return ['customer_group_id' => $this->getCustomerGroupId($data)];
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:22,代碼來源:Curl.php

示例10: createAttributeSet

 /**
  * Create Attribute Set
  *
  * @param CatalogAttributeSet $fixture
  * @return string
  */
 protected function createAttributeSet(CatalogAttributeSet $fixture)
 {
     $data = $fixture->getData();
     if (!isset($data['gotoEdit'])) {
         $data['gotoEdit'] = 1;
     }
     $data['skeleton_set'] = $fixture->getDataFieldConfig('skeleton_set')['source']->getAttributeSet()->getAttributeSetId();
     $url = $_ENV['app_backend_url'] . 'catalog/product_set/save/';
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->addOption(CURLOPT_HEADER, 1);
     $curl->write($url, $data);
     $response = $curl->read();
     $curl->close();
     return $response;
 }
開發者ID:andrewhowdencom,項目名稱:m2onk8s,代碼行數:21,代碼來源:Curl.php

示例11: persist

 /**
  * Post request for creating a cms page.
  *
  * @param FixtureInterface $fixture
  * @return array
  * @throws \Exception
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $url = $_ENV['app_backend_url'] . $this->url;
     $data = $this->replaceMappingData($fixture->getData());
     $data = $this->prepareData($data);
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->addOption(CURLOPT_HEADER, 1);
     $curl->write(CurlInterface::POST, $url, '1.1', [], $data);
     $response = $curl->read();
     $curl->close();
     if (!strpos($response, 'class="success-msg"')) {
         throw new \Exception("Cms page entity creating by curl handler was not successful! Response: {$response}");
     }
     $id = $this->getCmsPageId($response);
     return ['page_id' => $id];
 }
開發者ID:hientruong90,項目名稱:ee_14_installer,代碼行數:23,代碼來源:Curl.php

示例12: persist

 /**
  * Post request for creating custom system variable.
  *
  * @param FixtureInterface $fixture
  * @return array|mixed
  * @throws \Exception
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $data['variable'] = $fixture->getData();
     $url = $_ENV['app_backend_url'] . 'admin/system_variable/save/back/edit/';
     $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("System Variable creation by curl handler was not successful! Response: {$response}");
     }
     preg_match("~Location: [^\\s]*system_variable\\/edit\\/variable_id\\/(\\d+)~", $response, $matches);
     $id = isset($matches[1]) ? $matches[1] : null;
     return ['variable_id' => $id];
 }
開發者ID:kidaa30,項目名稱:magento2-platformsh,代碼行數:23,代碼來源:Curl.php

示例13: persist

 /**
  * Post request for creating a cms page.
  *
  * @param FixtureInterface $fixture
  * @return array
  * @throws \Exception
  */
 public function persist(FixtureInterface $fixture = null)
 {
     $url = $_ENV['app_backend_url'] . $this->url;
     $data = $this->prepareData($this->replaceMappingData($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("Cms page entity creating by curl handler was not successful! Response: {$response}");
     }
     preg_match("~page_id\\/(\\d*?)\\/~", $response, $matches);
     $id = isset($matches[1]) ? $matches[1] : null;
     return ['page_id' => $id];
 }
開發者ID:Doability,項目名稱:magento2dev,代碼行數:23,代碼來源:Curl.php

示例14: getWebSiteIdByWebsiteName

 /**
  * Get website id by website name
  *
  * @param string $websiteName
  * @return int
  * @throws \Exception
  */
 protected function getWebSiteIdByWebsiteName($websiteName)
 {
     //Set pager limit to 2000 in order to find created website by name
     $url = $_ENV['app_backend_url'] . 'admin/system_store/index/sort/group_title/dir/asc/limit/2000';
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->addOption(CURLOPT_HEADER, 1);
     $curl->write(CurlInterface::POST, $url, '1.0');
     $response = $curl->read();
     $expectedUrl = '/admin/system_store/editWebsite/website_id/';
     $expectedUrl = preg_quote($expectedUrl);
     $expectedUrl = str_replace('/', '\\/', $expectedUrl);
     preg_match('/' . $expectedUrl . '([0-9]*)\\/(.)*>' . $websiteName . '<\\/a>/', $response, $matches);
     if (empty($matches)) {
         throw new \Exception('Cannot find website id.');
     }
     return intval($matches[1]);
 }
開發者ID:shabbirvividads,項目名稱:magento2,代碼行數:24,代碼來源:Curl.php

示例15: getStoreId

 /**
  * Get Store id by name after creating Store
  *
  * @param string $name
  * @return int|null
  * @throws \Exception
  */
 protected function getStoreId($name)
 {
     //Set pager limit to 2000 in order to find created store view by name
     $url = $_ENV['app_backend_url'] . 'admin/system_store/index/sort/store_title/dir/asc/limit/2000';
     $curl = new BackendDecorator(new CurlTransport(), $this->_configuration);
     $curl->addOption(CURLOPT_HEADER, 1);
     $curl->write($url, [], CurlInterface::GET);
     $response = $curl->read();
     $expectedUrl = '/admin/system_store/editStore/store_id/';
     $expectedUrl = preg_quote($expectedUrl);
     $expectedUrl = str_replace('/', '\\/', $expectedUrl);
     preg_match('/' . $expectedUrl . '([0-9]*)\\/(.)*>' . $name . '<\\/a>/', $response, $matches);
     if (empty($matches)) {
         throw new \Exception('Cannot find store id');
     }
     return empty($matches[1]) ? null : $matches[1];
 }
開發者ID:andrewhowdencom,項目名稱:m2onk8s,代碼行數:24,代碼來源:Curl.php


注:本文中的Magento\Mtf\Util\Protocol\CurlTransport\BackendDecorator::addOption方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。