Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions tests/JsonLdContributorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public function test_an_entry_is_an_article(): void
'https://example.test/posts/hello',
'Hello World',
'My Site',
'AAAAAAAAAAAAAAAAAAAAAA==',
['title' => 'Hello World', 'published_at' => '2026-08-01T09:00:00+00:00'],
);

Expand All @@ -39,7 +40,7 @@ public function test_an_entry_is_an_article(): void

public function test_the_home_page_is_a_website(): void
{
$html = $this->contributor->head(new PageContext('home', 'https://example.test/', 'Home', 'My Site'));
$html = $this->contributor->head(new PageContext('home', 'https://example.test/', 'Home', 'My Site', 'AAAAAAAAAAAAAAAAAAAAAA=='));

self::assertStringContainsString('"@type":"WebSite"', $html);
self::assertStringContainsString('"name":"My Site"', $html);
Expand All @@ -48,15 +49,15 @@ public function test_the_home_page_is_a_website(): void

public function test_a_collection_page_is_a_collection_page(): void
{
$html = $this->contributor->head(new PageContext('collection', 'https://example.test/posts', 'Posts', 'My Site'));
$html = $this->contributor->head(new PageContext('collection', 'https://example.test/posts', 'Posts', 'My Site', 'AAAAAAAAAAAAAAAAAAAAAA=='));

self::assertStringContainsString('"@type":"CollectionPage"', $html);
self::assertStringContainsString('"name":"Posts"', $html);
}

public function test_a_missing_publish_time_is_omitted(): void
{
$page = new PageContext('entry', 'https://example.test/posts/x', 'X', 'My Site', ['title' => 'X']);
$page = new PageContext('entry', 'https://example.test/posts/x', 'X', 'My Site', 'AAAAAAAAAAAAAAAAAAAAAA==', ['title' => 'X']);

self::assertStringNotContainsString('datePublished', $this->contributor->head($page));
}
Expand All @@ -68,6 +69,7 @@ public function test_it_cannot_break_out_of_the_script_element(): void
'https://example.test/x',
'Pwned</script><script>alert(1)</script>',
'My Site',
'AAAAAAAAAAAAAAAAAAAAAA==',
['title' => 'x'],
);

Expand All @@ -83,6 +85,6 @@ public function test_it_cannot_break_out_of_the_script_element(): void

public function test_an_unknown_page_kind_contributes_nothing(): void
{
self::assertSame('', $this->contributor->head(new PageContext('mystery', 'https://example.test/', 'X', 'S')));
self::assertSame('', $this->contributor->head(new PageContext('mystery', 'https://example.test/', 'X', 'S', 'AAAAAAAAAAAAAAAAAAAAAA==')));
}
}
2 changes: 1 addition & 1 deletion tests/PackageIntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private function installedAs(): string

private function home(): PageContext
{
return new PageContext('home', 'https://example.test/', 'Home', 'My Site');
return new PageContext('home', 'https://example.test/', 'Home', 'My Site', 'AAAAAAAAAAAAAAAAAAAAAA==');
}

// ------------------------------------------------------- the manifest
Expand Down
Loading