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->find('/item2/item2-2'); $this->uri->initializeWithURL('http://testing.dev/item2/item2-2')->init(); } protected function _after(): void { $this->config->set('system.home.alias', $this->old_home); } public function testProcessImageHtml(): void { self::assertRegexp( '|Sample Image|', Excerpts::processImageHtml('Sample Image', $this->page) ); self::assertRegexp( '|Sample Image|', Excerpts::processImageHtml('Sample Image', $this->page) ); } public function testNoProcess(): void { self::assertStringStartsWith( 'regular process') ); self::assertStringStartsWith( 'noprocess') ); self::assertStringStartsWith( 'noprocess=id') ); } public function testTarget(): void { self::assertStringStartsWith( 'only target') ); self::assertStringStartsWith( 'target and rel') ); } }