Example #1
0
 public function testInvalidLinksSubDirAbsoluteUrl()
 {
     $this->config->set('system.absolute_urls', true);
     $this->uri->initializeWithUrlAndRootPath('http://testing.dev/subdir/item2/item2-2', '/subdir')->init();
     $this->assertSame('<p><a href="http://testing.dev/subdir/item2/item2-2/no-page">Non Existent Page</a></p>', $this->parsedown->text('[Non Existent Page](no-page)'));
     $this->assertSame('<p><a href="http://testing.dev/subdir/item2/item2-2/existing-file.zip">Existent File</a></p>', $this->parsedown->text('[Existent File](existing-file.zip)'));
     $this->assertSame('<p><a href="http://testing.dev/subdir/item2/item2-2/missing-file.zip">Non Existent File</a></p>', $this->parsedown->text('[Non Existent File](missing-file.zip)'));
 }
Example #2
0
 public function testRootUrl()
 {
     //Without explicitly adding the root path via `initializeWithUrlAndRootPath`,
     //tests always default to the base empty root path
     $this->uri->initializeWithURL('http://localhost/a-page')->init();
     $this->assertSame('http://localhost', $this->uri->rootUrl(true));
     $this->uri->initializeWithURL('http://localhost:8080/a-page')->init();
     $this->assertSame('http://localhost:8080', $this->uri->rootUrl(true));
     $this->uri->initializeWithURL('http://foobar.it:80/a-page')->init();
     $this->assertSame('http://foobar.it', $this->uri->rootUrl(true));
     $this->uri->initializeWithURL('https://google.com/a-page/xxx')->init();
     $this->assertSame('http://google.com', $this->uri->rootUrl(true));
     $this->uri->initializeWithUrlAndRootPath('https://localhost/grav/page-foo', '/grav')->init();
     $this->assertSame('/grav', $this->uri->rootUrl());
     $this->assertSame('http://localhost/grav', $this->uri->rootUrl(true));
 }