+
+ /**
+ * Test redirectFromReferer() - From another domain -> we ignore the given referrer.
+ */
+ public function testRedirectExternalReferer(): void
+ {
+ $this->container->environment['HTTP_REFERER'] = 'http://other.domain.tld/controller?query=param&other=2';
+
+ $response = new Response();
+
+ $result = $this->controller->redirectFromReferer($this->request, $response, ['query'], ['query']);
+
+ static::assertSame(302, $result->getStatusCode());
+ static::assertSame(['/subfolder/'], $result->getHeader('location'));
+ }
+
+ /**
+ * Test redirectFromReferer() - From another domain -> we ignore the given referrer.
+ */
+ public function testRedirectExternalRefererExplicitDomainName(): void
+ {
+ $this->container->environment['SERVER_NAME'] = 'my.shaarli.tld';
+ $this->container->environment['HTTP_REFERER'] = 'http://your.shaarli.tld/controller?query=param&other=2';
+
+ $response = new Response();
+
+ $result = $this->controller->redirectFromReferer($this->request, $response, ['query'], ['query']);
+
+ static::assertSame(302, $result->getStatusCode());
+ static::assertSame(['/subfolder/'], $result->getHeader('location'));
+ }