mirror of
https://github.com/getgrav/grav.git
synced 2026-07-19 21:41:14 +02:00
fixed a conflict with environment and host
This commit is contained in:
@@ -21,6 +21,7 @@ class Uri
|
||||
protected $content_path;
|
||||
protected $extension;
|
||||
protected $host;
|
||||
protected $env;
|
||||
protected $params;
|
||||
protected $path;
|
||||
protected $paths;
|
||||
@@ -41,6 +42,7 @@ class Uri
|
||||
$this->params = [];
|
||||
$this->query = [];
|
||||
$this->name = $this->buildHostname();
|
||||
$this->env = $this->buildEnvironment();
|
||||
$this->port = $this->buildPort();
|
||||
$this->uri = $this->buildUri();
|
||||
$this->scheme = $this->buildScheme();
|
||||
@@ -150,18 +152,23 @@ class Uri
|
||||
* @return string
|
||||
*/
|
||||
private function buildHost()
|
||||
{
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
private function buildEnvironment()
|
||||
{
|
||||
// set hostname
|
||||
$address = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '::1';
|
||||
|
||||
// check for localhost variations
|
||||
if ($this->name == 'localhost' || $address == '::1' || $address == '127.0.0.1') {
|
||||
$host = 'localhost';
|
||||
$env = 'localhost';
|
||||
} else {
|
||||
$host = $this->name;
|
||||
$env = $this->name;
|
||||
}
|
||||
|
||||
return $host;
|
||||
return $env;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -182,6 +189,7 @@ class Uri
|
||||
$this->params = [];
|
||||
$this->query = [];
|
||||
$this->name = [];
|
||||
$this->env = [];
|
||||
$this->port = [];
|
||||
$this->uri = [];
|
||||
$this->base = [];
|
||||
@@ -189,12 +197,17 @@ class Uri
|
||||
$this->root = [];
|
||||
$this->url = [];
|
||||
|
||||
$params = parse_url($url);
|
||||
$params = Uri::parseUrl($url);
|
||||
|
||||
$this->name = $params['host'];
|
||||
$this->port = isset($params['port']) ? $params['port'] : '80';
|
||||
|
||||
$this->uri = $params['path'];
|
||||
|
||||
if (isset($params['params'])) {
|
||||
$this->params($params['params']);
|
||||
}
|
||||
|
||||
if (isset($params['query'])) {
|
||||
$this->uri .= '?' . $params['query'];
|
||||
parse_str($params['query'], $this->query);
|
||||
@@ -202,6 +215,7 @@ class Uri
|
||||
|
||||
$this->base = $this->buildBaseUrl();
|
||||
$this->host = $this->buildHost();
|
||||
$this->env = $this->buildEnvironment();
|
||||
$this->root_path = $this->buildRootPath();
|
||||
$this->root = $this->base . $this->root_path;
|
||||
$this->url = $this->base . $this->uri;
|
||||
@@ -529,7 +543,7 @@ class Uri
|
||||
*/
|
||||
public function environment()
|
||||
{
|
||||
return $this->host();
|
||||
return $this->env;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -61,10 +61,25 @@ class MarkdownTest extends \Codeception\TestCase\Test
|
||||
{
|
||||
}
|
||||
|
||||
public function testAnchorLinksNoPortAbsoluteUrls()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', true);
|
||||
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="http://testing.dev/item2/item2-1#foo">Peer Anchor</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor](../item2-1#foo)'));
|
||||
$this->assertSame('<p><a href="http://testing.dev/item2/item2-1#foo">Peer Anchor 2</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'));
|
||||
$this->assertSame('<p><a href="http://testing.dev/item2/item2-2#foo">Current Anchor</a></p>',
|
||||
$this->parsedown->text('[Current Anchor](#foo)'));
|
||||
$this->assertSame('<p><a href="http://testing.dev/#foo">Root Anchor</a></p>',
|
||||
$this->parsedown->text('[Root Anchor](/#foo)'));
|
||||
}
|
||||
|
||||
public function testDirectoryRelativeLinks()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithURL('http://localhost/item2/item2-2')->init();
|
||||
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="/item3/item3-3/foo:bar">Up and Down with Param</a></p>',
|
||||
$this->parsedown->text('[Up and Down with Param](../../03.item3/03.item3-3/foo:bar)'));
|
||||
@@ -85,7 +100,7 @@ class MarkdownTest extends \Codeception\TestCase\Test
|
||||
public function testSlugRelativeLinks()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithURL('http://localhost/item2/item2-2')->init();
|
||||
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="/">Up to Root Level</a></p>',
|
||||
$this->parsedown->text('[Up to Root Level](../..)'));
|
||||
@@ -120,7 +135,7 @@ class MarkdownTest extends \Codeception\TestCase\Test
|
||||
public function testAnchorLinksNoPortRelativeUrls()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithURL('http://localhost/item2/item2-2')->init();
|
||||
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="/item2/item2-2#foo">Current Anchor</a></p>',
|
||||
$this->parsedown->text('[Current Anchor](#foo)'));
|
||||
@@ -132,40 +147,27 @@ class MarkdownTest extends \Codeception\TestCase\Test
|
||||
$this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'));
|
||||
}
|
||||
|
||||
public function testAnchorLinksNoPortAbsoluteUrls()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', true);
|
||||
$this->uri->initializeWithURL('http://localhost/item2/item2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="http://localhost/item2/item2-1#foo">Peer Anchor</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor](../item2-1#foo)'));
|
||||
$this->assertSame('<p><a href="http://localhost/item2/item2-1#foo">Peer Anchor 2</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'));
|
||||
$this->assertSame('<p><a href="http://localhost/item2/item2-2#foo">Current Anchor</a></p>',
|
||||
$this->parsedown->text('[Current Anchor](#foo)'));
|
||||
$this->assertSame('<p><a href="http://localhost/#foo">Root Anchor</a></p>',
|
||||
$this->parsedown->text('[Root Anchor](/#foo)'));
|
||||
}
|
||||
|
||||
public function testAnchorLinksWithPortAbsoluteUrls()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', true);
|
||||
$this->uri->initializeWithURL('http://localhost:8080/item2/item2-2')->init();
|
||||
$this->uri->initializeWithURL('http://testing.dev:8080/item2/item2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="http://localhost:8080/item2/item2-1#foo">Peer Anchor</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev:8080/item2/item2-1#foo">Peer Anchor</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor](../item2-1#foo)'));
|
||||
$this->assertSame('<p><a href="http://localhost:8080/item2/item2-1#foo">Peer Anchor 2</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev:8080/item2/item2-1#foo">Peer Anchor 2</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'));
|
||||
$this->assertSame('<p><a href="http://localhost:8080/item2/item2-2#foo">Current Anchor</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev:8080/item2/item2-2#foo">Current Anchor</a></p>',
|
||||
$this->parsedown->text('[Current Anchor](#foo)'));
|
||||
$this->assertSame('<p><a href="http://localhost:8080/#foo">Root Anchor</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev:8080/#foo">Root Anchor</a></p>',
|
||||
$this->parsedown->text('[Root Anchor](/#foo)'));
|
||||
}
|
||||
|
||||
public function testAnchorLinksSubDirRelativeUrls()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithUrlAndRootPath('http://localhost/subdir/item2/item2-2', '/subdir')->init();
|
||||
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
|
||||
|
||||
$this->assertSame('<p><a href="/subdir/item2/item2-1#foo">Peer Anchor</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor](../item2-1#foo)'));
|
||||
@@ -180,15 +182,15 @@ class MarkdownTest extends \Codeception\TestCase\Test
|
||||
public function testAnchorLinksSubDirAbsoluteUrls()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', true);
|
||||
$this->uri->initializeWithUrlAndRootPath('http://localhost/subdir/item2/item2-2', '/subdir')->init();
|
||||
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
|
||||
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item2/item2-1#foo">Peer Anchor</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item2/item2-1#foo">Peer Anchor</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor](../item2-1#foo)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item2/item2-1#foo">Peer Anchor 2</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item2/item2-1#foo">Peer Anchor 2</a></p>',
|
||||
$this->parsedown->text('[Peer Anchor 2](../item2-1/#foo)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item2/item2-2#foo">Current Anchor</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item2/item2-2#foo">Current Anchor</a></p>',
|
||||
$this->parsedown->text('[Current Anchor](#foo)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/#foo">Root Anchor</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/#foo">Root Anchor</a></p>',
|
||||
$this->parsedown->text('[Root Anchor](/#foo)'));
|
||||
}
|
||||
|
||||
@@ -196,34 +198,34 @@ class MarkdownTest extends \Codeception\TestCase\Test
|
||||
public function testSlugRelativeLinksAbsoluteUrls()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', true);
|
||||
$this->uri->initializeWithURL('http://localhost/item2/item2-2')->init();
|
||||
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="http://localhost/item2/item2-1">Peer Page</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/item2/item2-1">Peer Page</a></p>',
|
||||
$this->parsedown->text('[Peer Page](../item2-1)'));
|
||||
$this->assertSame('<p><a href="http://localhost/item2/item2-2/item2-2-1">Down a Level</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/item2/item2-2/item2-2-1">Down a Level</a></p>',
|
||||
$this->parsedown->text('[Down a Level](item2-2-1)'));
|
||||
$this->assertSame('<p><a href="http://localhost/item2">Up a Level</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/item2">Up a Level</a></p>',
|
||||
$this->parsedown->text('[Up a Level](..)'));
|
||||
$this->assertSame('<p><a href="http://localhost/">Up to Root Level</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/">Up to Root Level</a></p>',
|
||||
$this->parsedown->text('[Up to Root Level](../..)'));
|
||||
$this->assertSame('<p><a href="http://localhost/item3/item3-3">Up and Down</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/item3/item3-3">Up and Down</a></p>',
|
||||
$this->parsedown->text('[Up and Down](../../item3/item3-3)'));
|
||||
$this->assertSame('<p><a href="http://localhost/item2/item2-2/item2-2-1?foo=bar">Down a Level with Query</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/item2/item2-2/item2-2-1?foo=bar">Down a Level with Query</a></p>',
|
||||
$this->parsedown->text('[Down a Level with Query](item2-2-1?foo=bar)'));
|
||||
$this->assertSame('<p><a href="http://localhost/item2?foo=bar">Up a Level with Query</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/item2?foo=bar">Up a Level with Query</a></p>',
|
||||
$this->parsedown->text('[Up a Level with Query](../?foo=bar)'));
|
||||
$this->assertSame('<p><a href="http://localhost/item3/item3-3?foo=bar">Up and Down with Query</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/item3/item3-3?foo=bar">Up and Down with Query</a></p>',
|
||||
$this->parsedown->text('[Up and Down with Query](../../item3/item3-3?foo=bar)'));
|
||||
$this->assertSame('<p><a href="http://localhost/item3/item3-3/foo:bar">Up and Down with Param</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/item3/item3-3/foo:bar">Up and Down with Param</a></p>',
|
||||
$this->parsedown->text('[Up and Down with Param](../../item3/item3-3/foo:bar)'));
|
||||
$this->assertSame('<p><a href="http://localhost/item3/item3-3#foo">Up and Down with Anchor</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/item3/item3-3#foo">Up and Down with Anchor</a></p>',
|
||||
$this->parsedown->text('[Up and Down with Anchor](../../item3/item3-3#foo)'));
|
||||
}
|
||||
|
||||
public function testSlugRelativeLinksSubDir()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithUrlAndRootPath('http://localhost/subdir/item2/item2-2', '/subdir')->init();
|
||||
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
|
||||
|
||||
$this->assertSame('<p><a href="/subdir/item2/item2-1">Peer Page</a></p>',
|
||||
$this->parsedown->text('[Peer Page](../item2-1)'));
|
||||
@@ -250,27 +252,27 @@ class MarkdownTest extends \Codeception\TestCase\Test
|
||||
public function testSlugRelativeLinksSubDirAbsoluteUrls()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', true);
|
||||
$this->uri->initializeWithUrlAndRootPath('http://localhost/subdir/item2/item2-2', '/subdir')->init();
|
||||
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
|
||||
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item2/item2-1">Peer Page</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item2/item2-1">Peer Page</a></p>',
|
||||
$this->parsedown->text('[Peer Page](../item2-1)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item2/item2-2/item2-2-1">Down a Level</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item2/item2-2/item2-2-1">Down a Level</a></p>',
|
||||
$this->parsedown->text('[Down a Level](item2-2-1)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item2">Up a Level</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item2">Up a Level</a></p>',
|
||||
$this->parsedown->text('[Up a Level](..)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir">Up to Root Level</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir">Up to Root Level</a></p>',
|
||||
$this->parsedown->text('[Up to Root Level](../..)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item3/item3-3">Up and Down</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item3/item3-3">Up and Down</a></p>',
|
||||
$this->parsedown->text('[Up and Down](../../item3/item3-3)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item2/item2-2/item2-2-1?foo=bar">Down a Level with Query</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item2/item2-2/item2-2-1?foo=bar">Down a Level with Query</a></p>',
|
||||
$this->parsedown->text('[Down a Level with Query](item2-2-1?foo=bar)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item2?foo=bar">Up a Level with Query</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item2?foo=bar">Up a Level with Query</a></p>',
|
||||
$this->parsedown->text('[Up a Level with Query](../?foo=bar)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item3/item3-3?foo=bar">Up and Down with Query</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item3/item3-3?foo=bar">Up and Down with Query</a></p>',
|
||||
$this->parsedown->text('[Up and Down with Query](../../item3/item3-3?foo=bar)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item3/item3-3/foo:bar">Up and Down with Param</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item3/item3-3/foo:bar">Up and Down with Param</a></p>',
|
||||
$this->parsedown->text('[Up and Down with Param](../../item3/item3-3/foo:bar)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item3/item3-3#foo">Up and Down with Anchor</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item3/item3-3#foo">Up and Down with Anchor</a></p>',
|
||||
$this->parsedown->text('[Up and Down with Anchor](../../item3/item3-3#foo)'));
|
||||
}
|
||||
|
||||
@@ -278,7 +280,7 @@ class MarkdownTest extends \Codeception\TestCase\Test
|
||||
public function testDirectoryAbsoluteLinks()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithURL('http://localhost/item2/item2-2')->init();
|
||||
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="/">Root</a></p>',
|
||||
$this->parsedown->text('[Root](/)'));
|
||||
@@ -299,7 +301,7 @@ class MarkdownTest extends \Codeception\TestCase\Test
|
||||
public function testDirectoryAbsoluteLinksSubDir()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithUrlAndRootPath('http://localhost/subdir/item2/item2-2', '/subdir')->init();
|
||||
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
|
||||
|
||||
$this->assertSame('<p><a href="/subdir/">Root</a></p>',
|
||||
$this->parsedown->text('[Root](/)'));
|
||||
@@ -320,28 +322,28 @@ class MarkdownTest extends \Codeception\TestCase\Test
|
||||
public function testDirectoryAbsoluteLinksSubDirAbsoluteUrl()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', true);
|
||||
$this->uri->initializeWithUrlAndRootPath('http://localhost/subdir/item2/item2-2', '/subdir')->init();
|
||||
$this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
|
||||
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/">Root</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/">Root</a></p>',
|
||||
$this->parsedown->text('[Root](/)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item2/item2-1">Peer Page</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item2/item2-1">Peer Page</a></p>',
|
||||
$this->parsedown->text('[Peer Page](/item2/item2-1)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item2/item2-2/item2-2-1">Down a Level</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item2/item2-2/item2-2-1">Down a Level</a></p>',
|
||||
$this->parsedown->text('[Down a Level](/item2/item2-2/item2-2-1)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item2">Up a Level</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item2">Up a Level</a></p>',
|
||||
$this->parsedown->text('[Up a Level](/item2)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item2?foo=bar">With Query</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item2?foo=bar">With Query</a></p>',
|
||||
$this->parsedown->text('[With Query](/item2?foo=bar)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item2/foo:bar">With Param</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item2/foo:bar">With Param</a></p>',
|
||||
$this->parsedown->text('[With Param](/item2/foo:bar)'));
|
||||
$this->assertSame('<p><a href="http://localhost/subdir/item2#foo">With Anchor</a></p>',
|
||||
$this->assertSame('<p><a href="http://testing.dev/subdir/item2#foo">With Anchor</a></p>',
|
||||
$this->parsedown->text('[With Anchor](/item2#foo)'));
|
||||
}
|
||||
|
||||
public function testSpecialProtocols()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithURL('http://localhost/item2/item2-2')->init();
|
||||
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="mailto:user@domain.com">mailto</a></p>',
|
||||
$this->parsedown->text('[mailto](mailto:user@domain.com)'));
|
||||
@@ -356,7 +358,7 @@ class MarkdownTest extends \Codeception\TestCase\Test
|
||||
public function testReferenceLinks()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithURL('http://localhost/item2/item2-2')->init();
|
||||
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
|
||||
|
||||
$sample = '[relative link][r_relative]
|
||||
[r_relative]: ../item2-3#blah';
|
||||
@@ -377,7 +379,7 @@ class MarkdownTest extends \Codeception\TestCase\Test
|
||||
public function testAttributeLinks()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithURL('http://localhost/item2/item2-2')->init();
|
||||
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="/item2/item2-3" class="button">Relative Class</a></p>',
|
||||
$this->parsedown->text('[Relative Class](../item2-3?classes=button)'));
|
||||
@@ -398,7 +400,7 @@ class MarkdownTest extends \Codeception\TestCase\Test
|
||||
public function testInvalidLinks()
|
||||
{
|
||||
$this->config->set('system.absolute_urls', false);
|
||||
$this->uri->initializeWithURL('http://localhost/item2/item2-2')->init();
|
||||
$this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
|
||||
|
||||
$this->assertSame('<p><a href="/item2/item2-2/no-page">Non Existent Page</a></p>',
|
||||
$this->parsedown->text('[Non Existent Page](no-page)'));
|
||||
|
||||
Reference in New Issue
Block a user