|
| 1 | +<?php |
| 2 | +/** |
| 3 | + * Copyright © 2013-2017 Magento, Inc. All rights reserved. |
| 4 | + * See COPYING.txt for license details. |
| 5 | + */ |
| 6 | + |
| 7 | +namespace Magento\CurrencySymbol\Test\Constraint; |
| 8 | + |
| 9 | +use Magento\Mtf\Fixture\InjectableFixture; |
| 10 | +use Magento\Catalog\Test\Page\Product\CatalogProductView; |
| 11 | +use Magento\Mtf\Client\BrowserInterface; |
| 12 | +use Magento\Mtf\Constraint\AbstractConstraint; |
| 13 | + |
| 14 | +/** |
| 15 | + * Check that correct currency symbol displayed on Product Page on Custom Website. |
| 16 | + */ |
| 17 | +class AssertCurrencySymbolOnProductPageCustomWebsite extends AbstractConstraint |
| 18 | +{ |
| 19 | + /** |
| 20 | + * Assert that correct currency symbol displayed on Product Page on Custom Website. |
| 21 | + * |
| 22 | + * @param InjectableFixture $product, |
| 23 | + * @param BrowserInterface $browser |
| 24 | + * @param CatalogProductView $catalogProductView |
| 25 | + * @param array $currencySymbol |
| 26 | + * @return void |
| 27 | + */ |
| 28 | + public function processAssert( |
| 29 | + InjectableFixture $product, |
| 30 | + BrowserInterface $browser, |
| 31 | + CatalogProductView $catalogProductView, |
| 32 | + array $currencySymbol = [] |
| 33 | + ) { |
| 34 | + $website = $product->getDataFieldConfig('website_ids')['source']->getWebsites()[0]; |
| 35 | + $url = $_ENV['app_frontend_url'] . 'websites/' . $website->getCode() . '/' . $product->getUrlKey() . '.html'; |
| 36 | + $browser->open($url); |
| 37 | + $priceBlock = $catalogProductView->getViewBlock()->getPriceBlock(); |
| 38 | + $symbolOnPage = $priceBlock->getCurrencySymbol(); |
| 39 | + |
| 40 | + \PHPUnit_Framework_Assert::assertEquals( |
| 41 | + $currencySymbol['customWebsite'], |
| 42 | + $symbolOnPage, |
| 43 | + 'Wrong Currency Symbol is displayed on Product page on Custom website.' |
| 44 | + ); |
| 45 | + } |
| 46 | + |
| 47 | + /** |
| 48 | + * Returns a string representation of successful assertion. |
| 49 | + * |
| 50 | + * @return string |
| 51 | + */ |
| 52 | + public function toString() |
| 53 | + { |
| 54 | + return "Correct Currency Symbol displayed on Product page on Custom website."; |
| 55 | + } |
| 56 | +} |
0 commit comments