本文整理汇总了PHP中Magento\Catalog\Test\Page\Product\CatalogProductView::getReviewFormBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP CatalogProductView::getReviewFormBlock方法的具体用法?PHP CatalogProductView::getReviewFormBlock怎么用?PHP CatalogProductView::getReviewFormBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Test\Page\Product\CatalogProductView
的用法示例。
在下文中一共展示了CatalogProductView::getReviewFormBlock方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAssert
/**
* Assert that product rating is not displayed on frontend on product review
*
* @param CatalogProductView $catalogProductView
* @param CatalogProductSimple $product
* @param Rating $productRating
* @param BrowserInterface $browser
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, CatalogProductSimple $product, Rating $productRating, BrowserInterface $browser)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getReviewSummary()->getAddReviewLink()->click();
$reviewForm = $catalogProductView->getReviewFormBlock();
\PHPUnit_Framework_Assert::assertFalse($reviewForm->isVisibleRating($productRating), 'Product rating "' . $productRating->getRatingCode() . '" is displayed.');
}
示例2: processAssert
/**
* Assert that product rating is not displayed on frontend on product review
*
* @param CatalogProductView $catalogProductView
* @param CatalogProductSimple $product
* @param Rating $productRating
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, CatalogProductSimple $product, Rating $productRating)
{
$catalogProductView->init($product);
$catalogProductView->open();
$catalogProductView->getReviewSummaryBlock()->getAddReviewLink()->click();
$reviewForm = $catalogProductView->getReviewFormBlock();
\PHPUnit_Framework_Assert::assertFalse($reviewForm->isVisibleRating($productRating), 'Product rating "' . $productRating->getRatingCode() . '" is displayed.');
}
示例3: processAssert
/**
* Assert that product rating is not displayed on frontend on product review
*
* @param CatalogProductView $catalogProductView
* @param CatalogProductSimple $product
* @param Rating $productRating
* @param Browser $browser
* @param ReviewInjectable $review
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, CatalogProductSimple $product, Rating $productRating, Browser $browser, ReviewInjectable $review = null)
{
$product = $review === null ? $product : $review->getDataFieldConfig('entity_id')['source']->getEntity();
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$catalogProductView->getReviewSummary()->getAddReviewLink()->click();
$reviewForm = $catalogProductView->getReviewFormBlock();
\PHPUnit_Framework_Assert::assertFalse($reviewForm->isVisibleRating($productRating), 'Product rating "' . $productRating->getRatingCode() . '" is displayed.');
}
示例4: processAssert
/**
* Assert that product rating is displayed on product review(frontend)
*
* @param CatalogProductView $catalogProductView
* @param CatalogProductSimple $product
* @param ReviewInjectable|null $review [optional]
* @param Rating|null $productRating [optional]
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, CatalogProductSimple $product, ReviewInjectable $review = null, Rating $productRating = null)
{
$catalogProductView->init($product);
$catalogProductView->open();
$catalogProductView->getReviewSummaryBlock()->getAddReviewLink()->click();
$rating = $productRating ? $productRating : $review->getDataFieldConfig('ratings')['source']->getRatings()[0];
$reviewForm = $catalogProductView->getReviewFormBlock();
\PHPUnit_Framework_Assert::assertTrue($reviewForm->isVisibleRating($rating), 'Product rating "' . $rating->getRatingCode() . '" is not displayed.');
}
示例5: processAssert
/**
* Assert that product rating is displayed on product review(frontend)
*
* @param CatalogProductView $catalogProductView
* @param BrowserInterface $browser
* @param CatalogProductSimple $product
* @param Review|null $review [optional]
* @param Rating|null $productRating [optional]
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, BrowserInterface $browser, CatalogProductSimple $product, Review $review = null, Rating $productRating = null)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$reviewSummaryBlock = $catalogProductView->getReviewSummary();
if ($reviewSummaryBlock->isVisible()) {
$reviewSummaryBlock->getAddReviewLink()->click();
}
$rating = $productRating ? $productRating : $review->getDataFieldConfig('ratings')['source']->getRatings()[0];
$reviewForm = $catalogProductView->getReviewFormBlock();
\PHPUnit_Framework_Assert::assertTrue($reviewForm->isVisibleRating($rating), 'Product rating "' . $rating->getRatingCode() . '" is not displayed.');
}
示例6: test
/**
* Run create frontend product rating test
*
* @param CatalogProductSimple $product
* @param ReviewInjectable $review
* @return void
*/
public function test(CatalogProductSimple $product, ReviewInjectable $review)
{
// Prepare for tear down
$this->review = $review;
// Steps
$this->catalogProductView->init($product);
$this->catalogProductView->open();
$this->catalogProductView->getReviewSummaryBlock()->getAddReviewLink()->click();
$reviewForm = $this->catalogProductView->getReviewFormBlock();
$reviewForm->fill($review);
$reviewForm->submit();
}
示例7: test
/**
* Run create frontend product rating test.
*
* @param Review $review
* @param BrowserInterface $browser
* @param AssertProductReviewIsAbsentOnProductPage $assertProductReviewIsAbsentOnProductPage
* @return array
*/
public function test(Review $review, BrowserInterface $browser, AssertProductReviewIsAbsentOnProductPage $assertProductReviewIsAbsentOnProductPage)
{
// Prepare for tear down
$this->review = $review;
// Steps
$product = $review->getDataFieldConfig('entity_id')['source']->getEntity();
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$assertProductReviewIsAbsentOnProductPage->processAssert($this->catalogProductView);
$this->catalogProductView->getReviewSummary()->clickAddReviewLink();
$reviewForm = $this->catalogProductView->getReviewFormBlock();
$reviewForm->fill($review);
$reviewForm->submit();
return ['product' => $product];
}
示例8: test
/**
* Run create frontend product rating test
*
* @param ReviewInjectable $review
* @param Browser $browser
* @return void
*/
public function test(ReviewInjectable $review, Browser $browser)
{
// Prepare for tear down
$this->review = $review;
// Steps
$product = $review->getDataFieldConfig('entity_id')['source']->getEntity();
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$reviewLink = $this->catalogProductView->getReviewSummary()->getAddReviewLink();
if ($reviewLink->isVisible()) {
$reviewLink->click();
}
$reviewForm = $this->catalogProductView->getReviewFormBlock();
$reviewForm->fill($review);
$reviewForm->submit();
}
示例9: test
/**
* Test Creation for CustomerReviewReportEntity
*
* @param Review $review
* @param Customer $customer
* @param $customerLogin
* @param CatalogProductSimple $product
* @param BrowserInterface $browser
* @return array
*
* @SuppressWarnings(PHPMD.ConstructorWithNameAsEnclosingClass)
*/
public function test(Review $review, Customer $customer, CatalogProductSimple $product, BrowserInterface $browser, $customerLogin)
{
// Preconditions
$product->persist();
$this->cmsIndex->open();
if ($customerLogin == 'Yes') {
$this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $customer])->run();
}
// Steps
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$this->pageCatalogProductView->getReviewSummary()->getAddReviewLink()->click();
$this->pageCatalogProductView->getReviewFormBlock()->fill($review);
$this->pageCatalogProductView->getReviewFormBlock()->submit();
return ['product' => $product];
}
示例10: test
/**
* Test Creation for CustomerReviewReportEntity
*
* @param Review $review
* @param Customer $customer
* @param $customerLogin
* @param CatalogProductSimple $product
* @param BrowserInterface $browser
* @return array
*
* @SuppressWarnings(PHPMD.ConstructorWithNameAsEnclosingClass)
*/
public function test(Review $review, Customer $customer, CatalogProductSimple $product, BrowserInterface $browser, $customerLogin)
{
// Preconditions
$product->persist();
$this->cmsIndex->open();
if ($customerLogin == 'Yes') {
$this->cmsIndex->getLinksBlock()->openLink("Log In");
$this->customerAccountLogin->getLoginBlock()->login($customer);
}
// Steps
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$this->pageCatalogProductView->getReviewSummary()->getAddReviewLink()->click();
$this->pageCatalogProductView->getReviewFormBlock()->fill($review);
$this->pageCatalogProductView->getReviewFormBlock()->submit();
return ['product' => $product];
}
示例11: processAssert
/**
* Assert that product review available on product page.
*
* @param CatalogProductView $catalogProductView
* @param Review $review
* @param FixtureInterface $product
* @param BrowserInterface $browser
* @param AdminCache $cachePage
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView, Review $review, FixtureInterface $product, BrowserInterface $browser, AdminCache $cachePage)
{
$errors = [];
$cachePage->open()->getActionsBlock()->flushMagentoCache();
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$reviewBlock = $catalogProductView->getCustomerReviewBlock();
$catalogProductView->getViewBlock()->selectTab('Reviews');
\PHPUnit_Framework_Assert::assertContains(sprintf("You're reviewing:\n%s", $product->getName()), $catalogProductView->getReviewFormBlock()->getLegend()->getText());
foreach ($review->getData() as $name => $value) {
$reviewValue = $reviewBlock->getFieldValue($name);
if ($reviewValue !== null && 0 !== strcasecmp($value, trim($reviewValue))) {
$errors[] = '- field "' . $name . '" is not equals submitted one, error value "' . $value . '"';
}
}
\PHPUnit_Framework_Assert::assertEmpty($errors, 'The Review contains the following errors:' . PHP_EOL . implode(PHP_EOL, $errors));
}
示例12: test
/**
* Run manage product review test
*
* @param Review $reviewInitial
* @param Review $review
* @param Customer $customer
* @return array
*/
public function test(Review $reviewInitial, Review $review, Customer $customer)
{
// Preconditions
$this->login($customer);
/** @var CatalogProductSimple $product */
$product = $reviewInitial->getDataFieldConfig('entity_id')['source']->getEntity();
$this->browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
$this->catalogProductView->getReviewSummary()->getAddReviewLink()->click();
$this->catalogProductView->getReviewFormBlock()->fill($reviewInitial);
$this->catalogProductView->getReviewFormBlock()->submit();
$this->reviewInitial = $reviewInitial;
// Steps
$this->customerIndex->open();
$this->customerIndex->getCustomerGridBlock()->searchAndOpen(['email' => $customer->getEmail()]);
$this->customerIndexEdit->getCustomerForm()->openTab('product_reviews');
$filter = ['title' => $reviewInitial->getTitle(), 'sku' => $product->getSku()];
$this->customerIndexEdit->getCustomerForm()->getTabElement('product_reviews')->getReviewsGrid()->searchAndOpen($filter);
$this->reviewEdit->getReviewForm()->fill($review);
$this->reviewEdit->getPageActions()->save();
return ['reviewInitial' => $reviewInitial, 'product' => $product];
}