本文整理匯總了PHP中Mtf\Fixture\FixtureInterface::getSku方法的典型用法代碼示例。如果您正苦於以下問題:PHP FixtureInterface::getSku方法的具體用法?PHP FixtureInterface::getSku怎麽用?PHP FixtureInterface::getSku使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mtf\Fixture\FixtureInterface
的用法示例。
在下文中一共展示了FixtureInterface::getSku方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: processAssert
/**
* Assert that duplicated product is found by sku and has correct product type, product template,
* product status disabled and out of stock
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid)
{
$config = $product->getDataConfig();
$filter = ['name' => $product->getName(), 'visibility' => $product->getVisibility(), 'status' => 'Disabled', 'sku' => $product->getSku() . '-1', 'type' => ucfirst($config['create_url_params']['type']) . ' Product', 'price_to' => number_format($product->getPrice(), 2)];
$productGrid->open()->getProductGrid()->search($filter);
$filter['price_to'] = '$' . $filter['price_to'];
\PHPUnit_Framework_Assert::assertTrue($productGrid->getProductGrid()->isRowVisible($filter, false), 'Product duplicate is absent in Products grid.');
}
示例2: processAssert
/**
* Assert form data equals fixture data
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $productPage
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
{
$filter = ['sku' => $product->getSku() . '-1'];
$productGrid->open()->getProductGrid()->searchAndOpen($filter);
$formData = $productPage->getProductForm()->getData($product);
$fixtureData = $this->prepareFixtureData($product->getData());
$errors = $this->verifyData($fixtureData, $formData);
\PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
}
示例3: processAssert
/**
* Assert form data equals fixture data
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $productPage
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
{
$filter = ['sku' => $product->getSku()];
$productGrid->open()->getProductGrid()->searchAndOpen($filter);
$formData = $productPage->getForm()->getData($product);
$fixtureData = $this->prepareFixtureData($product);
$errors = $this->compareArray($fixtureData, $formData);
\PHPUnit_Framework_Assert::assertTrue(empty($errors), "These data must be equal to each other:\n" . implode("\n", $errors));
}
示例4: prepareData
/**
* Prepare array for assert
*
* @param CatalogProductView $catalogProductView
* @return array
*/
protected function prepareData(CatalogProductView $catalogProductView)
{
$viewBlock = $catalogProductView->getViewBlock();
$price = $viewBlock->getProductPriceBlock()->getPrice();
$data = ['onPage' => ['name' => $viewBlock->getProductName(), 'sku' => $viewBlock->getProductSku()], 'fixture' => ['name' => $this->product->getName(), 'sku' => $this->product->getSku()]];
list($priceOnPage, $priceFixture) = $this->preparePrice($price);
$data['onPage'] += $priceOnPage;
$data['fixture'] += $priceFixture;
if ($productShortDescription = $this->product->getShortDescription()) {
$data['fixture']['short_description'] = $productShortDescription;
$data['onPage']['short_description'] = $viewBlock->getProductShortDescription();
}
if ($productDescription = $this->product->getDescription()) {
$data['fixture']['description'] = $productDescription;
$data['onPage']['description'] = $viewBlock->getProductDescription();
}
return $data;
}
示例5: assertOnProductView
/**
* Assert prices on the product view page
*
* @param CatalogProductView $catalogProductView
* @return void
*/
protected function assertOnProductView(CatalogProductView $catalogProductView)
{
$viewBlock = $catalogProductView->getViewBlock();
$price = $viewBlock->getProductPriceBlock()->getPrice();
$errorsMessages = ['name' => '- product name on product view page is not correct.', 'sku' => '- product sku on product view page is not correct.', 'regular_price' => '- product regular price on product view page is not correct.', 'short_description' => '- product short description on product view page is not correct.', 'description' => '- product description on product view page is not correct.'];
$dataOnPage = ['name' => $viewBlock->getProductName(), 'sku' => $viewBlock->getProductSku(), 'regular_price' => $price['price_regular_price']];
$compareData = ['name' => $this->product->getName(), 'sku' => $this->product->getSku(), 'regular_price' => number_format($this->product->getPrice(), 2)];
if ($productShortDescription = $this->product->getShortDescription()) {
$compareData['short_description'] = $productShortDescription;
$dataOnPage['short_description'] = $viewBlock->getProductShortDescription();
}
if ($productDescription = $this->product->getDescription()) {
$compareData['description'] = $productDescription;
$dataOnPage['description'] = $viewBlock->getProductDescription();
}
$badValues = array_diff($dataOnPage, $compareData);
$errorsMessages = array_merge($this->assertSpecialPrice($price), array_intersect_key($errorsMessages, array_keys($badValues)));
\PHPUnit_Framework_Assert::assertTrue(empty($errorsMessages), PHP_EOL . 'Found the following errors:' . PHP_EOL . implode(' ' . PHP_EOL, $errorsMessages));
}
示例6: processAssert
/**
* Assert form data equals fixture data
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $productPage
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
{
$filter = ['sku' => $product->getSku()];
$productGrid->open()->getProductGrid()->searchAndOpen($filter);
$fieldsForm = $productPage->getForm()->getData($product);
$fieldsFixture = $this->prepareFixtureData($product->getData());
$fieldsFixture['associated'] = $this->prepareGroupedOptions($fieldsFixture['associated']);
$errors = $this->verifyData($fieldsFixture, $fieldsForm);
\PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
}
示例7: findCartItems
/**
* Find cart item blocks for associated products
*
* @param FixtureInterface $product
* @return array
*/
protected function findCartItems(FixtureInterface $product)
{
$cartItems = [];
/** @var GroupedProductInjectable $product */
$associatedProducts = $product->getAssociated()['products'];
foreach ($associatedProducts as $product) {
$cartItems[$product->getSku()] = parent::getCartItem($product);
}
return $cartItems;
}
示例8: processAssert
/**
* Assert that product can be searched via Quick Search using searchable product attributes (Search by SKU)
*
* @param CatalogsearchResult $catalogSearchResult
* @param CmsIndex $cmsIndex
* @param FixtureInterface $product
* @return void
*/
public function processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, FixtureInterface $product)
{
$cmsIndex->open();
$cmsIndex->getSearchBlock()->search($product->getSku());
$isInStock = $product->getQuantityAndStockStatus();
if ($product->getVisibility() === 'Catalog' || isset($isInStock['is_in_stock']) && $isInStock['is_in_stock'] === 'Out of Stock') {
$isVisible = !$catalogSearchResult->getListProductBlock()->isProductVisible($product->getName());
$this->errorMessage = 'Product successfully found by SKU.';
$this->successfulMessage = 'The product has not been found by SKU.';
} else {
$isVisible = $catalogSearchResult->getListProductBlock()->isProductVisible($product->getName());
}
\PHPUnit_Framework_Assert::assertTrue($isVisible, $this->errorMessage);
}
示例9: processAssert
/**
* Assert form data equals duplicate product configurable data
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $productPage
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
{
$duplicateProductSku = $product->getSku() . '-1';
$filter = ['sku' => $duplicateProductSku];
$productGrid->open();
$productGrid->getProductGrid()->searchAndOpen($filter);
$productData = $product->getData();
$productData['sku'] = $duplicateProductSku;
$productData['status'] = 'Product offline';
$fixtureData = $this->prepareFixtureData($productData, $this->sortFields);
$formData = $this->prepareFormData($productPage->getProductForm()->getData($product), $this->sortFields);
$error = $this->verifyData($fixtureData, $formData);
\PHPUnit_Framework_Assert::assertTrue(empty($error), $error);
}
示例10: processAssert
/**
* Assert form data equals fixture data
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $productPage
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
{
$filter = ['sku' => $product->getSku()];
$productGrid->open();
$productGrid->getProductGrid()->searchAndOpen($filter);
$productData = $product->getData();
if ($product->hasData('custom_options')) {
$customOptionsSource = $product->getDataFieldConfig('custom_options')['source'];
$productData['custom_options'] = $customOptionsSource->getCustomOptions();
}
$fixtureData = $this->prepareFixtureData($productData, $this->sortFields);
$formData = $this->prepareFormData($productPage->getProductForm()->getData($product), $this->sortFields);
$error = $this->verifyData($fixtureData, $formData);
\PHPUnit_Framework_Assert::assertTrue(empty($error), $error);
}
示例11: processAssert
/**
* Assert that displayed product data on edit page equals passed from fixture
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @param CatalogProductEdit $productPage
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid, CatalogProductEdit $productPage)
{
$productGrid->open()->getProductGrid()->searchAndOpen(['sku' => $product->getSku()]);
$form = $productPage->getForm();
$formData = $form->getData($product);
foreach (array_keys($formData['configurable_attributes_data']['matrix']) as $key) {
unset($formData['configurable_attributes_data']['matrix'][$key]['price']);
}
$fixtureData = $this->prepareFixtureData($product->getData(), $product);
$attributes = $fixtureData['configurable_attributes_data']['attributes_data'];
$matrix = $fixtureData['configurable_attributes_data']['matrix'];
unset($fixtureData['configurable_attributes_data'], $fixtureData['id']);
$fixtureData['configurable_attributes_data']['attributes_data'] = $this->prepareAttributes($attributes);
$fixtureData['configurable_attributes_data']['matrix'] = $this->prepareMatrix($matrix);
$errors = $this->verifyData($fixtureData, $formData);
\PHPUnit_Framework_Assert::assertEmpty($errors, $errors);
}
示例12: processAssert
/**
* Assert that product can be searched via Quick Search using searchable product attributes (Search by SKU)
*
* @param CatalogsearchResult $catalogSearchResult
* @param CmsIndex $cmsIndex
* @param FixtureInterface $product
* @return void
*
* @SuppressWarnings(PHPMD.NPathComplexity)
*/
public function processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, FixtureInterface $product)
{
$cmsIndex->open();
$sku = $product->hasData('sku') !== false ? $product->getSku() : $product->getName();
$cmsIndex->getSearchBlock()->search($sku);
$quantityAndStockStatus = $product->getQuantityAndStockStatus();
$stockStatus = isset($quantityAndStockStatus['is_in_stock']) ? $quantityAndStockStatus['is_in_stock'] : null;
$isVisible = $catalogSearchResult->getListProductBlock()->isProductVisible($product->getName());
while (!$isVisible && $catalogSearchResult->getBottomToolbar()->nextPage()) {
$isVisible = $catalogSearchResult->getListProductBlock()->isProductVisible($product->getName());
}
if ($product->getVisibility() === 'Catalog' || $stockStatus === 'Out of Stock') {
$isVisible = !$isVisible;
list($this->errorMessage, $this->successfulMessage) = [$this->successfulMessage, $this->errorMessage];
}
\PHPUnit_Framework_Assert::assertTrue($isVisible, $this->errorMessage);
}
示例13: isNotDisplayingOnFrontendAssert
/**
* Verify product displaying on frontend
*
* @param FixtureInterface $product
* @return array
*/
protected function isNotDisplayingOnFrontendAssert(FixtureInterface $product)
{
$errors = [];
// Check the product page is not available
// TODO fix initialization url for frontend page
$this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$titleBlock = $this->catalogProductView->getTitleBlock();
if ($titleBlock->getTitle() !== self::NOT_FOUND_MESSAGE) {
$errors[] = '- the headline on the page does not match, the text should be -> "' . self::NOT_FOUND_MESSAGE . '".';
}
$this->cmsIndex->open();
$this->cmsIndex->getSearchBlock()->search($product->getSku());
if ($this->catalogSearchResult->getListProductBlock()->isProductVisible($product->getName())) {
$errors[] = '- successful product search.';
}
$categoryName = $product->hasData('category_ids') ? $product->getCategoryIds()[0] : $this->category->getName();
$this->cmsIndex->open();
$this->cmsIndex->getTopmenu()->selectCategoryByName($categoryName);
$isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
while (!$isProductVisible && $this->catalogCategoryView->getBottomToolbar()->nextPage()) {
$isProductVisible = $this->catalogCategoryView->getListProductBlock()->isProductVisible($product->getName());
}
if ($isProductVisible) {
$errors[] = '- product with name "{$product->getName()}" is found in this category.';
}
return $errors;
}
示例14: processAssert
/**
* Assert that product cannot be found via Quick Search using searchable product attributes.
*
* @param CatalogsearchResult $catalogSearchResult
* @param CmsIndex $cmsIndex
* @param FixtureInterface $product
* @return void
*/
public function processAssert(CatalogsearchResult $catalogSearchResult, CmsIndex $cmsIndex, FixtureInterface $product)
{
$cmsIndex->open();
$cmsIndex->getSearchBlock()->search($product->getSku());
\PHPUnit_Framework_Assert::assertFalse($catalogSearchResult->getListProductBlock()->isProductVisible($product->getName()), 'Product was found by SKU.');
}
示例15: processAssert
/**
* Assert product availability in products grid
*
* @param FixtureInterface $product
* @param CatalogProductIndex $productGrid
* @return void
*/
public function processAssert(FixtureInterface $product, CatalogProductIndex $productGrid)
{
$filter = ['sku' => $product->getSku()];
$productGrid->open();
\PHPUnit_Framework_Assert::assertTrue($productGrid->getProductGrid()->isRowVisible($filter), 'Product with sku \'' . $product->getSku() . '\' is absent in Products grid.');
}