Take the site address from SITE_URL.

The feed links, the notification email, the webmaster address and the cookie domain now use it.
This commit is contained in:
tim
2026-09-26 15:27:51 +02:00
parent 52f4855850
commit 5d657d7e45
11 changed files with 75 additions and 30 deletions
+5 -1
View File
@@ -31,7 +31,11 @@ class FeedAndImageTest extends PageTestCase {
// The front page, then the visible stories, newest first
$this->assertSame(array('Front Page', 'Tom & "Jerry"', 'Picture', 'Not an image'),
array_map('strval', iterator_to_array($xml->xpath('/rss/channel/item/title'), FALSE)));
$this->assertSame('http://xxx.org.za/article?id=1', (string)$items[1]->link);
// The addresses come from SITE_URL
$this->assertSame('https://site.test/', (string)$xml->channel->link);
$this->assertSame('https://site.test/article?id=1', (string)$items[1]->link);
$this->assertSame('editor@site.test (Editors)', (string)$xml->channel->managingEditor);
$this->assertStringContainsString('edi', $feed['body']);
$this->assertSame('Wait… a bold move & more.', (string)$items[1]->description);
$this->assertSame('Ann <ann>', (string)$items[1]->children('http://purl.org/dc/elements/1.1/')->creator);
$this->assertSame('Image: Picture', (string)$items[2]->description);
+3 -1
View File
@@ -32,7 +32,7 @@ class FrontPagesTest extends PageTestCase {
public function testTheSessionCookieIsSecure(): void {
$cookie = $this->header($this->get('/'), 'Set-Cookie');
$this->assertMatchesRegularExpression('/^PHPSESSID=[0-9a-z,-]+;/', $cookie);
foreach (array('path=/', 'domain=.xxx.org.za', 'secure', 'HttpOnly', 'SameSite=Lax') as $flag)
foreach (array('path=/', 'domain=.site.test', 'secure', 'HttpOnly', 'SameSite=Lax') as $flag)
$this->assertStringContainsString("; $flag", $cookie);
}
@@ -89,6 +89,8 @@ class FrontPagesTest extends PageTestCase {
$page = $this->get('/about');
$this->assertSame(200, $page['status']);
$this->assertStringContainsString('</html>', $page['body']);
// The webmaster's address, at the host of SITE_URL, hidden from harvesters
$this->assertStringContainsString('<a href="' . hidden_email('mailto:webmaster@site.test') . '">email us</a>', $page['body']);
}
public function testTheTestsAreNotServed(): void {
+3 -3
View File
@@ -16,8 +16,8 @@ class EmailTest extends TestCase {
public function testGoesToTheEditorsFromTheQueue(): void {
$mail = $this->send('A title', 'Ann', '<p>Hello.</p>');
$this->assertSame('editor@xxx.org.za', $mail['headers']['to']);
$this->assertSame('x.x.x Queue <editor@xxx.org.za>', $mail['headers']['from']);
$this->assertSame('editor@site.test', $mail['headers']['to']);
$this->assertSame('x.x.x Queue <editor@site.test>', $mail['headers']['from']);
$this->assertSame('New submission: A title', $mail['subject']);
}
@@ -29,7 +29,7 @@ class EmailTest extends TestCase {
$mail = $this->send('T', 'Ann', "<p>First &amp; <strong>bold</strong>.</p>\n<p>Line one<br />line two</p><p></p><p>&lt;b&gt; is text &#8220;quoted&#8221;</p>");
$this->assertSame("Please review the queue. Ann has sent the following new submission:\n\n"
. "First & bold.\n\nLine one\nline two\n\n<b> is text “quoted”"
. "\n\nhttp://xxx.org.za/publish/edit", trim($mail['body']));
. "\n\nhttps://site.test/publish/edit", trim($mail['body']));
}
public function testLongLinesAreWrapped(): void {