本文整理汇总了PHP中Magento\Mtf\Client\BrowserInterface::getUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP BrowserInterface::getUrl方法的具体用法?PHP BrowserInterface::getUrl怎么用?PHP BrowserInterface::getUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Mtf\Client\BrowserInterface
的用法示例。
在下文中一共展示了BrowserInterface::getUrl方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: processAssert
/**
* Assert that you will be redirected to url from dataset
*
* @param CmsIndex $cmsIndex
* @param BrowserInterface $browser
* @param CatalogSearchQuery $searchTerm
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, BrowserInterface $browser, CatalogSearchQuery $searchTerm)
{
$cmsIndex->open()->getSearchBlock()->search($searchTerm->getSynonymFor());
$windowUrl = $browser->getUrl();
$redirectUrl = $searchTerm->getRedirect();
\PHPUnit_Framework_Assert::assertEquals($windowUrl, $redirectUrl, 'Redirect by synonym was not executed.' . PHP_EOL . "Expected: " . $redirectUrl . PHP_EOL . "Actual: " . $windowUrl);
}
示例2: processAssert
/**
* Assert that Secure Urls Enabled.
*
* @param BrowserInterface $browser
* @param Dashboard $dashboard
* @param CustomerAccountLogin $customerAccountLogin
* @return void
*/
public function processAssert(BrowserInterface $browser, Dashboard $dashboard, CustomerAccountLogin $customerAccountLogin)
{
$dashboard->open();
\PHPUnit_Framework_Assert::assertTrue(strpos($browser->getUrl(), 'https://') !== false, 'Secure Url is not displayed on backend.');
$customerAccountLogin->open();
\PHPUnit_Framework_Assert::assertTrue(strpos($browser->getUrl(), 'https://') !== false, 'Secure Url is not displayed on frontend.');
}
示例3: processAssert
/**
* Assert that apache redirect works by opening category page and asserting index.php in its url.
*
* @param CatalogCategory $category
* @param CmsIndex $homePage
* @param BrowserInterface $browser
*/
public function processAssert(CatalogCategory $category, CmsIndex $homePage, BrowserInterface $browser)
{
$category->persist();
$homePage->open();
$homePage->getTopmenu()->selectCategory($category->getName());
\PHPUnit_Framework_Assert::assertTrue(strpos($browser->getUrl(), 'index.php') === false, 'Apache redirect for category does not work.');
}
示例4: processAssert
/**
* Assert that outside redirect was success
*
* @param UrlRewrite $urlRewrite
* @param BrowserInterface $browser
* @param UrlRewrite|null $initialRewrite [optional]
* @return void
*/
public function processAssert(UrlRewrite $urlRewrite, BrowserInterface $browser, UrlRewrite $initialRewrite = null)
{
$urlRequestPath = $urlRewrite->hasData('request_path') ? $urlRewrite->getRequestPath() : $initialRewrite->getRequestPath();
$urlTargetPath = $urlRewrite->hasData('target_path') ? $urlRewrite->getTargetPath() : $initialRewrite->getTargetPath();
$browser->open($_ENV['app_frontend_url'] . $urlRequestPath);
$browserUrl = $browser->getUrl();
\PHPUnit_Framework_Assert::assertEquals($browserUrl, $urlTargetPath, 'URL rewrite redirect false.' . "\nExpected: " . $urlTargetPath . "\nActual: " . $browserUrl);
}
示例5: processAssert
/**
* Check that Shopping Cart is empty, opened page contains text "You have no items in your shopping cart.
* Click here to continue shopping." where 'here' is link that leads to index page
*
* @param CheckoutCart $checkoutCart
* @param BrowserInterface $browser
* @return void
*/
public function processAssert(CheckoutCart $checkoutCart, BrowserInterface $browser)
{
$checkoutCart->open();
$cartEmptyBlock = $checkoutCart->getCartEmptyBlock();
\PHPUnit_Framework_Assert::assertEquals(self::TEXT_EMPTY_CART, $cartEmptyBlock->getText(), 'Wrong text on empty cart page.');
$cartEmptyBlock->clickLinkToMainPage();
\PHPUnit_Framework_Assert::assertEquals($_ENV['app_frontend_url'], $browser->getUrl(), 'Wrong link to main page on empty cart page.');
}
示例6: processAssert
/**
* Assert that created CMS Page URL Rewrite lead to appropriate page in frontend.
*
* @param UrlRewrite $urlRewrite
* @param CmsPage $cmsPage
* @param SystemVariableNew $systemVariableNew
* @param BrowserInterface $browser
* @return void
*/
public function processAssert(UrlRewrite $urlRewrite, CmsPage $cmsPage, SystemVariableNew $systemVariableNew, BrowserInterface $browser)
{
$browser->open($_ENV['app_frontend_url'] . $urlRewrite->getRequestPath());
if ($urlRewrite->hasData('store_id')) {
$store = explode('/', $urlRewrite->getStoreId());
$systemVariableNew->getFormPageActions()->selectStoreView($store[2]);
}
$url = $urlRewrite->getRedirectType() == 'No' ? $urlRewrite->getRequestPath() : $cmsPage->getTitle();
\PHPUnit_Framework_Assert::assertEquals($_ENV['app_frontend_url'] . $url, $browser->getUrl(), 'URL rewrite CMS Page redirect false.');
}
示例7: assertGeneralInformation
/**
* Assert category general information
*
* @param Category $category
* @param array $categoryData
* @return void
*/
protected function assertGeneralInformation(Category $category, array $categoryData)
{
$categoryUrl = $this->getCategoryUrl($category);
\PHPUnit_Framework_Assert::assertEquals($categoryUrl, $this->browser->getUrl(), 'Wrong page URL.' . "\nExpected: " . $categoryUrl . "\nActual: " . $this->browser->getUrl());
if (isset($categoryData['name'])) {
$title = $this->categoryViewPage->getTitleBlock()->getTitle();
\PHPUnit_Framework_Assert::assertEquals($categoryData['name'], $title, 'Wrong page title.' . "\nExpected: " . $categoryData['name'] . "\nActual: " . $title);
}
if (isset($categoryData['description'])) {
$description = $this->categoryViewPage->getViewBlock()->getDescription();
\PHPUnit_Framework_Assert::assertEquals($categoryData['description'], $description, 'Wrong category description.' . "\nExpected: " . $categoryData['description'] . "\nActual: " . $description);
}
}
示例8: verifySearchEngineOptimization
/**
* Verify category Search Engine Optimization data:
* # URL
* # Meta Title
*
* @param array $categoryData
* @return array
*/
protected function verifySearchEngineOptimization(array $categoryData)
{
$errorMessage = [];
$categoryUrl = $this->getCategoryUrl($this->category);
if ($categoryUrl != $this->browser->getUrl()) {
$errorMessage[] = 'Wrong page URL.' . "\nExpected: " . $categoryUrl . "\nActual: " . $this->browser->getUrl();
}
if (isset($categoryData['meta_title'])) {
$actual = $this->categoryViewPage->getMetaInformation()->getTitle();
if ($categoryData['meta_title'] != $actual) {
$errorMessage[] = 'Wrong page title.' . "\nExpected: " . $categoryData['meta_title'] . "\nActual: " . $actual;
}
}
return $errorMessage;
}
示例9: openDownloadableLink
/**
* Open Downloadable Link.
*
* @param OrderInjectable $order
* @param int $downloads
* @return void
*/
protected function openDownloadableLink(OrderInjectable $order, $downloads)
{
$customerLogin = $this->objectManager->create('Magento\\Customer\\Test\\TestStep\\LoginCustomerOnFrontendStep', ['customer' => $order->getDataFieldConfig('customer_id')['source']->getCustomer()]);
$customerLogin->run();
$this->customerAccount->getAccountMenuBlock()->openMenuItem('My Downloadable Products');
$downloadableProductsUrl = $this->browser->getUrl();
foreach ($order->getEntityId()['products'] as $product) {
foreach ($product->getDownloadableLinks()['downloadable']['link'] as $link) {
for ($i = 0; $i < $downloads; $i++) {
$this->browser->open($this->customerProducts->getMainBlock()->getLinkUrl($link['title']));
$this->browser->open($downloadableProductsUrl);
}
}
}
}
示例10: processAssert
/**
* Assert that after save a search term:
* - it displays in the Search field at the top of the page if type set of characters passed from fixture
* - after click 'Go' of Search field opens a results page if it was not specified Redirect URL
* - after click 'Go' of Search field a customer search redirects to a specific page (passed from fixture)
* if it was specified Redirect URL
*
* @param CmsIndex $cmsIndex
* @param CatalogSearchQuery $searchTerm
* @param BrowserInterface $browser
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, CatalogSearchQuery $searchTerm, BrowserInterface $browser)
{
$errors = [];
$this->searchBlock = $cmsIndex->open()->getSearchBlock();
if ($searchTerm->hasData('display_in_terms') && $searchTerm->getDisplayInTerms() === 'Yes') {
$errors = $this->checkSuggestSearch($searchTerm);
}
$this->searchBlock->search($searchTerm->getQueryText());
$windowUrl = $browser->getUrl();
$redirectUrl = $searchTerm->getRedirect();
if ($windowUrl !== $redirectUrl) {
$errors[] = '- url window (' . $windowUrl . ') does not match the url redirect(' . $redirectUrl . ')';
}
\PHPUnit_Framework_Assert::assertEmpty($errors, 'When checking on the frontend "Search terms" arose following errors:' . PHP_EOL . implode(PHP_EOL, $errors));
}
示例11: processAssert
/**
* Assert that you will be not redirected to url from dataset
*
* @param CmsIndex $cmsIndex
* @param CatalogSearchQuery $searchTerm
* @param BrowserInterface $browser
* @return void
*/
public function processAssert(CmsIndex $cmsIndex, BrowserInterface $browser, CatalogSearchQuery $searchTerm)
{
$cmsIndex->open()->getSearchBlock()->search($searchTerm->getSynonymFor());
\PHPUnit_Framework_Assert::assertNotEquals($browser->getUrl(), $searchTerm->getRedirect(), 'Url in the browser corresponds to Url in fixture (redirect has been performed).' . PHP_EOL . 'Search term: "' . $searchTerm->getQueryText() . '"');
}
示例12: processAssert
/**
* Assert that old Category URL lead to appropriate Category in frontend
*
* @param Category $category
* @param BrowserInterface $browser
* @param Category $initialCategory
* @return void
*/
public function processAssert(Category $category, BrowserInterface $browser, Category $initialCategory)
{
$browser->open($_ENV['app_frontend_url'] . $initialCategory->getUrlKey() . '.html');
\PHPUnit_Framework_Assert::assertEquals($browser->getUrl(), $_ENV['app_frontend_url'] . strtolower($category->getUrlKey()) . '.html', 'URL rewrite category redirect false.');
}
示例13: processAssert
/**
* Assert check URL rewrite category redirect
*
* @param UrlRewrite $urlRewrite
* @param Category $category
* @param BrowserInterface $browser
* @return void
*/
public function processAssert(UrlRewrite $urlRewrite, Category $category, BrowserInterface $browser)
{
$browser->open($_ENV['app_frontend_url'] . $urlRewrite->getRequestPath());
$url = $urlRewrite->getRedirectType() == 'No' ? $urlRewrite->getRequestPath() : $category->getUrlKey() . '.html';
\PHPUnit_Framework_Assert::assertEquals($browser->getUrl(), $_ENV['app_frontend_url'] . $url, 'URL rewrite category redirect false.' . "\nExpected: " . $_ENV['app_frontend_url'] . $url . "\nActual: " . $browser->getUrl());
}