本文整理汇总了PHP中Magento\Catalog\Test\Page\Product\CatalogProductView::getReviewSummary方法的典型用法代码示例。如果您正苦于以下问题:PHP CatalogProductView::getReviewSummary方法的具体用法?PHP CatalogProductView::getReviewSummary怎么用?PHP CatalogProductView::getReviewSummary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Catalog\Test\Page\Product\CatalogProductView
的用法示例。
在下文中一共展示了CatalogProductView::getReviewSummary方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAssert
/**
* Assert that add view review links are present on product page.
*
* @param Browser $browser
* @param CatalogProductView $catalogProductView
* @param InjectableFixture $product
* @return void
*/
public function processAssert(Browser $browser, CatalogProductView $catalogProductView, InjectableFixture $product)
{
$browser->open($_ENV['app_frontend_url'] . $product->getUrlKey() . '.html');
// Verify add review link
\PHPUnit_Framework_Assert::assertTrue($catalogProductView->getReviewSummary()->getAddReviewLink()->isVisible(), 'Add review link is not visible on product page.');
// Verify view review link
$viewReviewLink = $catalogProductView->getReviewSummary()->getViewReviewLink();
\PHPUnit_Framework_Assert::assertTrue($viewReviewLink->isVisible(), 'View review link is not visible on product page.');
\PHPUnit_Framework_Assert::assertContains('1', $viewReviewLink->getText(), 'There is more than 1 approved review.');
}
示例2: 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.');
}
示例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 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.');
}
示例5: 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];
}
示例6: 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();
}
示例7: 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];
}
示例8: 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];
}
示例9: 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];
}
示例10: processAssert
/**
* Assert that product doesn't have a review on product page.
*
* @param CatalogProductView $catalogProductView
* @return void
*/
public function processAssert(CatalogProductView $catalogProductView)
{
$catalogProductView->getViewBlock()->selectTab('Reviews');
\PHPUnit_Framework_Assert::assertFalse($catalogProductView->getCustomerReviewBlock()->isVisibleReviewItem(), 'No reviews below the form required.');
\PHPUnit_Framework_Assert::assertEquals(self::NO_REVIEW_LINK_TEXT, trim($catalogProductView->getReviewSummary()->getAddReviewLink()->getText()), sprintf('"%s" link is not available', self::NO_REVIEW_LINK_TEXT));
}