示例#1
0
 public function testInvalidLinks()
 {
     $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)'));
     $this->assertSame('<p><a href="/item2/item2-2/existing-file.zip">Existent File</a></p>', $this->parsedown->text('[Existent File](existing-file.zip)'));
     $this->assertSame('<p><a href="/item2/item2-2/missing-file.zip">Non Existent File</a></p>', $this->parsedown->text('[Non Existent File](missing-file.zip)'));
 }
示例#2
0
 public function testAddNonce()
 {
     $url = 'http://localhost/foo';
     $this->assertStringStartsWith($url, Uri::addNonce($url, 'test-action'));
     $this->assertStringStartsWith($url . '/nonce:', Uri::addNonce($url, 'test-action'));
     $this->uri->initializeWithURL(Uri::addNonce($url, 'test-action'))->init();
     $this->assertTrue(is_string($this->uri->param('nonce')));
     $this->assertSame(Utils::getNonce('test-action'), $this->uri->param('nonce'));
 }
示例#3
0
 protected function _before()
 {
     $grav = Fixtures::get('grav');
     $this->grav = $grav();
     $this->pages = $this->grav['pages'];
     $this->config = $this->grav['config'];
     $this->uri = $this->grav['uri'];
     $this->language = $this->grav['language'];
     $this->old_home = $this->config->get('system.home.alias');
     $this->config->set('system.home.alias', '/item1');
     $this->config->set('system.absolute_urls', false);
     $this->config->set('system.languages.supported', []);
     unset($this->grav['language']);
     $this->grav['language'] = new Language($this->grav);
     /** @var UniformResourceLocator $locator */
     $locator = $this->grav['locator'];
     $locator->addPath('page', '', 'tests/fake/nested-site/user/pages', false);
     $this->pages->init();
     $defaults = ['extra' => false, 'auto_line_breaks' => false, 'auto_url_links' => false, 'escape_markup' => false, 'special_chars' => ['>' => 'gt', '<' => 'lt']];
     $this->page = $this->pages->dispatch('/item2/item2-2');
     $this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init();
 }