/** * Tests the toUriString() method with internal: URIs. * * @covers ::toUriString * * @dataProvider providerTestToUriStringForInternal */ public function testToUriStringForInternal($uri, $options, $uri_string) { $url = Url::fromRoute('entity.test_entity.canonical', ['test_entity' => '1']); $this->pathValidator->expects($this->any())->method('getUrlIfValidWithoutAccessCheck')->willReturnMap([['test-entity/1', $url], ['<front>', Url::fromRoute('<front>')], ['<none>', Url::fromRoute('<none>')]]); $url = Url::fromUri($uri, $options); $this->assertSame($url->toUriString(), $uri_string); }
/** * @covers ::processOutbound */ public function testOutboundPathProcessorMaxDepth() { $this->pathValidator->expects($this->any()) ->method('getUrlIfValidWithoutAccessCheck') ->willReturn(new Url('any_route')); $this->subPathautoSettings->expects($this->exactly(2)) ->method('get') ->willReturn(3); $this->aliasProcessor->expects($this->any()) ->method('processOutbound') ->will($this->returnCallback([$this, 'aliasByPathCallback'])); // Subpath shouldn't be processed since the iterations has been limited. $processed = $this->sut->processOutbound('/node/1/first/second/third/fourth'); $this->assertEquals('/node/1/first/second/third/fourth', $processed); // Subpath should be processed when the max depth doesn't exceed. $processed = $this->sut->processOutbound('/node/1/first/second/third'); $this->assertEquals('/content/first-node/first/second/third', $processed); }