Skip to content

Commit 5c00e28

Browse files
Merge branch '6.2' into 6.3
2 parents 1da13bc + 883cc15 commit 5c00e28

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,6 @@ on:
88
jobs:
99
ci:
1010
name: CI
11+
# Do not run if this is a pull-request from same repo i.e. not a fork repo
12+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository
1113
uses: silverstripe/gha-ci/.github/workflows/ci.yml@v1

src/Publisher.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public function generatePageResponse($url)
8989
}
9090
try {
9191
$ssl = Environment::getEnv('SS_STATIC_FORCE_SSL');
92-
if (is_null($ssl)) {
92+
if (!$ssl) {
9393
$ssl = $urlParts['scheme'] == 'https' ? true : false;
9494
}
9595

tests/php/Publisher/FilesystemPublisherTest.php

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ public function testUrlToPathWithDomainBasedCaching(): void
135135
'domain2.com/parent/child',
136136
$urlToPath->invokeArgs($this->fsp, [$url])
137137
);
138+
139+
$url = 'https://domain2.com/parent/child';
140+
$this->assertSame(
141+
'domain2.com/parent/child',
142+
$urlToPath->invokeArgs($this->fsp, [$url])
143+
);
138144
}
139145

140146
public function testMenu2LinkingMode(): void
@@ -351,7 +357,22 @@ public function providePathsToURL()
351357
];
352358
}
353359

354-
public function testGetPublishedURLs(): void
360+
public function provideGetPublishedURLs(): array
361+
{
362+
return [
363+
[
364+
'baseURL' => 'http://example.com',
365+
],
366+
[
367+
'baseURL' => 'https://example.com',
368+
],
369+
];
370+
}
371+
372+
/**
373+
* @dataProvider provideGetPublishedURLs
374+
*/
375+
public function testGetPublishedURLs(string $baseUrl): void
355376
{
356377
$level1 = new StaticPublisherTestPage();
357378
$level1->URLSegment = 'find-me';
@@ -368,19 +389,19 @@ public function testGetPublishedURLs(): void
368389

369390
$this->fsp->publishURL('find-me', true);
370391
// We have to redeclare this config because the testkernel wipes it when we generate the page response
371-
Director::config()->set('alternate_base_url', 'http://example.com');
392+
Director::config()->set('alternate_base_url', $baseUrl);
372393

373-
$this->assertSame(['http://example.com/find-me'], $this->fsp->getPublishedURLs());
394+
$this->assertSame([$baseUrl . '/find-me'], $this->fsp->getPublishedURLs());
374395

375396
$this->fsp->publishURL($level2_1->Link(), true);
376-
Director::config()->set('alternate_base_url', 'http://example.com');
397+
Director::config()->set('alternate_base_url', $baseUrl);
377398

378399
$urls = $this->fsp->getPublishedURLs();
379-
$this->assertContains('http://example.com/find-me', $urls);
380-
$this->assertContains('http://example.com/find-me/find-me-child', $urls);
400+
$this->assertContains($baseUrl . '/find-me', $urls);
401+
$this->assertContains($baseUrl . '/find-me/find-me-child', $urls);
381402
$this->assertCount(2, $urls);
382403

383404
$this->fsp->purgeURL('find-me');
384-
$this->assertSame(['http://example.com/find-me/find-me-child'], $this->fsp->getPublishedURLs());
405+
$this->assertSame([$baseUrl . '/find-me/find-me-child'], $this->fsp->getPublishedURLs());
385406
}
386407
}

0 commit comments

Comments
 (0)