Definition at line 11 of file UrlTest.php.
◆ consequentCallsDataProvider()
consequentCallsDataProvider |
( |
| ) |
|
Data provider for testGetUrlOnConsequentCalls()
@SuppressWarnings(PHPMD.ExcessiveMethodLength)
- Returns
- array
Definition at line 327 of file UrlTest.php.
331 'r_1/c_1/a_1/p_1/v_1',
332 'r_1/c_1/a_1/p_1/v_1',
335 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_1/',
336 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_1/',
339 'r_1/c_1/a_1/p_1/v_1',
340 'r_1/c_1/a_1/p_1/v_2',
343 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_1/',
344 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_2/' 347 'r_1/c_1/a_1/p_1/v_1',
351 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_1/',
352 'http://localhost/index.php/r_1/c_1/a_1/' 355 'r_1/c_1/a_1/p_1/v_1',
356 'r_1/c_1/a_1/p_2/v_2',
359 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_1/',
360 'http://localhost/index.php/r_1/c_1/a_1/p_2/v_2/' 363 'r_1/c_1/a_1/p_1/v_1',
367 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_1/',
368 'http://localhost/index.php/r_1/c_1/a_1/' 371 'r_1/c_1/a_1/p_1/v_1',
375 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_1/',
376 'http://localhost/index.php/r_1/c_1/a_2/' 379 'r_1/c_1/a_1/p_1/v_1',
383 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_1/',
384 'http://localhost/index.php/r_1/c_1/' 387 'r_1/c_1/a_1/p_1/v_1',
391 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_1/',
392 'http://localhost/index.php/r_1/c_2/' 395 'r_1/c_1/a_1/p_1/v_1',
399 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_1/',
400 'http://localhost/index.php/r_1/' 403 'r_1/c_1/a_1/p_1/v_1',
407 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_1/',
408 'http://localhost/index.php/r_2/' 411 'r_1/c_1/a_1/p_1/v_1',
415 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_1/',
416 'http://localhost/index.php/' 420 'r_1/c_1/a_1/p_1/v_1',
423 'http://localhost/index.php/r_1/c_1/a_1/',
424 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_1/' 431 'http://localhost/index.php/',
432 'http://localhost/index.php/r_1/c_1/a_1/' 435 'r_1/c_1/a_1/p_1/v_1',
436 'r_1/c_1/a_1/p_1/v_1',
439 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_1/p_2/v_2/',
440 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_1/p_2/v_2/' 443 'r_1/c_1/a_1/p_1/v_1',
447 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_1/p_2/v_2/',
448 'http://localhost/index.php/r_1/c_1/a_1/p_2/v_2/' 451 'r_1/c_1/a_1/p_1/v_1',
454 [
'p_1' =>
'v_1',
'p_2' =>
'v_2'],
455 'http://localhost/index.php/r_1/c_1/a_1/p_1/v_1/p_2/v_2/',
456 'http://localhost/index.php/p_1/v_1/p_2/v_2/'
◆ getBaseUrlConfiguredDataProvider()
getBaseUrlConfiguredDataProvider |
( |
| ) |
|
Definition at line 192 of file UrlTest.php.
198 'http://sample.com/base_link_path/index.php/' 202 'https://sample.com/base_link_path/index.php/'
◆ setUp()
Definition at line 18 of file UrlTest.php.
static getObjectManager()
◆ testEscape()
Definition at line 461 of file UrlTest.php.
463 $this->assertEquals(
'%22%27%3E%3C', $this->model->escape(
'"\'><'));
◆ testGetBaseUrlConfigured()
testGetBaseUrlConfigured |
( |
|
$params, |
|
|
|
$expectedUrl |
|
) |
| |
Note: isolation flushes the URL memory cache @magentoAppIsolation enabled
@dataProvider getBaseUrlConfiguredDataProvider
@magentoConfigFixture current_store web/secure/base_url http://sample.com/base_path/ @magentoConfigFixture current_store web/unsecure/base_link_url http://sample.com/base_link_path/ @magentoConfigFixture current_store web/secure/base_link_url https://sample.com/base_link_path/ @magentoConfigFixture current_store web/secure/use_in_frontend 1
- Parameters
-
array | $params | |
string | $expectedUrl | |
Definition at line 75 of file UrlTest.php.
77 $actualUrl = $this->model->getBaseUrl(
$params);
78 $this->assertEquals($expectedUrl, $actualUrl);
$params[\Magento\Store\Model\StoreManager::PARAM_RUN_CODE]
◆ testGetBaseUrlDefaults()
testGetBaseUrlDefaults |
( |
| ) |
|
Note: isolation should be raised to flush the URL memory cache maintained by the store model @magentoAppIsolation enabled
Definition at line 46 of file UrlTest.php.
48 $this->assertEquals(
'http://localhost/index.php/', $this->model->getBaseUrl());
◆ testGetBaseUrlSeoRewrites()
testGetBaseUrlSeoRewrites |
( |
| ) |
|
Note: isolation flushes the URL memory cache @magentoAppIsolation enabled @magentoConfigFixture current_store web/seo/use_rewrites 1
Definition at line 56 of file UrlTest.php.
58 $this->assertEquals(
'http://localhost/', $this->model->getBaseUrl());
◆ testGetBaseUrlWithTypeRestoring()
testGetBaseUrlWithTypeRestoring |
( |
| ) |
|
Check that url type is restored to default after call getBaseUrl with type specified in params
Get base URL with default type
Set specified type
Get url with type specified in params
Definition at line 170 of file UrlTest.php.
175 $this->assertEquals(
'http://localhost/index.php/', $this->model->getBaseUrl(),
'Incorrect link url');
181 $this->assertEquals(
'http://localhost/', $webUrl,
'Incorrect web url');
182 $this->assertEquals(
'http://localhost/index.php/', $this->model->getBaseUrl(),
'Incorrect link url');
188 $this->assertEquals(
'http://localhost/pub/media/', $mediaUrl,
'Incorrect media url');
189 $this->assertEquals(
'http://localhost/index.php/', $this->model->getBaseUrl(),
'Incorrect link url');
◆ testGetConfigData()
Definition at line 37 of file UrlTest.php.
39 $this->assertEquals(
'http://localhost/', $this->model->getConfigData(
'base_url'));
◆ testGetDirectUrl()
Note: isolation flushes the URL memory cache @magentoAppIsolation enabled
Definition at line 470 of file UrlTest.php.
472 $directUrl = $this->model->getDirectUrl(
'fancy_uri', [
'_query' => [
'foo' =>
'bar']]);
473 $this->assertEquals(
'http://localhost/index.php/fancy_uri?foo=bar', $directUrl);
◆ testGetRouteUrl()
Note: isolation flushes the URL memory cache @magentoAppIsolation enabled
Definition at line 235 of file UrlTest.php.
237 $this->assertEquals(
'http://localhost/index.php/', $this->model->getRouteUrl());
239 'http://localhost/index.php/catalog/product/view/id/50/',
240 $this->model->getRouteUrl(
'catalog/product/view', [
'id' => 50])
243 'http://localhost/index.php/fancy_uri',
244 $this->model->getRouteUrl(
'core/index/index', [
'_direct' =>
'fancy_uri'])
◆ testGetUrl()
Note: isolation flushes the URL memory cache @magentoAppIsolation enabled
Definition at line 258 of file UrlTest.php.
260 $result = $this->model->getUrl(
261 'catalog/product/view',
262 [
'_fragment' =>
'anchor',
'_escape' => 1,
'_query' =>
'foo=bar',
'_nosid' => 1,
'id' => 100]
264 $this->assertEquals(
'http://localhost/index.php/catalog/product/view/id/100/?foo=bar#anchor',
$result);
◆ testGetUrlDoesntAddFragmentOnConsequentCalls()
testGetUrlDoesntAddFragmentOnConsequentCalls |
( |
| ) |
|
Note: isolation flushes the URL memory cache @magentoAppIsolation enabled @covers \Magento\Framework\Url::getUrl
Definition at line 284 of file UrlTest.php.
286 $result = $this->model->getUrl(
'catalog/product/view', [
'_nosid' => 1,
'_fragment' =>
'section']);
287 $this->assertEquals(
'http://localhost/index.php/catalog/product/view/#section',
$result);
288 $result = $this->model->getUrl(
'catalog/product/view', [
'_nosid' => 1]);
289 $this->assertEquals(
'http://localhost/index.php/catalog/product/view/',
$result);
◆ testGetUrlDoesntAddQueryParamsOnConsequentCalls()
testGetUrlDoesntAddQueryParamsOnConsequentCalls |
( |
| ) |
|
Note: isolation flushes the URL memory cache @magentoAppIsolation enabled
Definition at line 271 of file UrlTest.php.
273 $result = $this->model->getUrl(
'catalog/product/view', [
'_query' =>
'foo=bar',
'_nosid' => 1]);
274 $this->assertEquals(
'http://localhost/index.php/catalog/product/view/?foo=bar',
$result);
275 $result = $this->model->getUrl(
'catalog/product/view', [
'_nosid' => 1]);
276 $this->assertEquals(
'http://localhost/index.php/catalog/product/view/',
$result);
◆ testGetUrlOnConsequentCalls()
testGetUrlOnConsequentCalls |
( |
|
$firstCallUrl, |
|
|
|
$secondCallUrl, |
|
|
|
$firstRouteParams, |
|
|
|
$secondRouteParams, |
|
|
|
$firstExpectedUrl, |
|
|
|
$secondExpectedUrl |
|
) |
| |
Note: isolation flushes the URL memory cache @magentoAppIsolation enabled
@dataProvider consequentCallsDataProvider
- Parameters
-
string | $firstCallUrl | |
string | $secondCallUrl | |
array | $firstRouteParams | |
array | $secondRouteParams | |
string | $firstExpectedUrl | |
string | $secondExpectedUrl | @covers \Magento\Framework\Url::getUrl |
Definition at line 306 of file UrlTest.php.
314 $result = $this->model->getUrl($firstCallUrl, $firstRouteParams);
315 $this->assertEquals($firstExpectedUrl,
$result);
317 $result = $this->model->getUrl($secondCallUrl, $secondRouteParams);
318 $this->assertEquals($secondExpectedUrl,
$result);
◆ testSessionUrlVar()
Note: isolation flushes the URL memory cache @magentoAppIsolation enabled
Note: to enforce SID in URLs, base URL must be different from the current $_SERVER['HTTP_HOST'] @magentoConfigFixture current_store web/unsecure/base_link_url http://domain.com/
Definition at line 483 of file UrlTest.php.
486 \
Magento\Framework\Session\Generic::class
488 $sessionUrl = $this->model->sessionUrlVar(
'<a href="http://example.com/?___SID=U">www.example.com</a>');
489 $this->assertEquals(
'<a href="http://example.com/?SID=' . $sessionId .
'">www.example.com</a>', $sessionUrl);
static getObjectManager()
◆ testSetGetActionName()
Definition at line 223 of file UrlTest.php.
225 $this->model->setActionName(
'view');
226 $this->assertEquals(
'view', $this->model->getActionName());
228 $this->markTestIncomplete(
'setActionName() logic is unclear.');
◆ testSetGetControllerName()
testSetGetControllerName |
( |
| ) |
|
Definition at line 215 of file UrlTest.php.
217 $this->model->setControllerName(
'product');
218 $this->assertEquals(
'product', $this->model->getControllerName());
220 $this->markTestIncomplete(
'setControllerName() logic is unclear.');
◆ testSetGetFragment()
Definition at line 248 of file UrlTest.php.
250 $this->model->setFragment(
'value');
251 $this->assertEquals(
'value', $this->model->getFragment());
◆ testSetGetRouteName()
Definition at line 207 of file UrlTest.php.
209 $this->model->setRouteName(
'catalog');
210 $this->assertEquals(
'catalog', $this->model->getRouteName());
212 $this->markTestIncomplete(
'setRouteName() logic is unclear.');
◆ testSetGetUseSession()
Definition at line 23 of file UrlTest.php.
25 $this->assertTrue((
bool)$this->model->getUseSession());
26 $this->model->setUseSession(
false);
27 $this->assertFalse($this->model->getUseSession());
◆ testSetRouteFrontName()
testSetRouteFrontName |
( |
| ) |
|
Definition at line 30 of file UrlTest.php.
33 $this->model->setRouteFrontName(
$value);
34 $this->assertEquals(
$value, $this->model->getData(
'route_front_name'));
◆ testUseSessionIdForUrl()
testUseSessionIdForUrl |
( |
| ) |
|
Definition at line 492 of file UrlTest.php.
494 $_SERVER[
'HTTP_HOST'] =
'localhost';
495 $this->assertFalse($this->model->useSessionIdForUrl(
true));
496 $this->assertFalse($this->model->useSessionIdForUrl(
false));
◆ $model
The documentation for this class was generated from the following file:
- vendor/magento/magento2-base/dev/tests/integration/testsuite/Magento/Framework/UrlTest.php