Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Go deeper with content #35

Merged
merged 5 commits into from
Dec 18, 2023
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
6 changes: 3 additions & 3 deletions tests/FileSystem/Directories/PublicDirectoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ class PublicDirectoryTest extends BaseTestCase
*/
public function is_expected_qualified_path(): void
{
$expected = (new SplFileInfo(parent::PUBLIC_BASE . '/deeper-page'))
$expected = (new SplFileInfo(parent::PUBLIC_BASE . '/l1-page'))
->getRealPath();

$sut = PublicDirectory::inRoot(
parent::root(),
'/deeper-page'
'/l1-page'
);

$result = $sut->toString();
Expand All @@ -40,7 +40,7 @@ public function can_check_existence(): void
{
$sut = PublicDirectory::inRoot(
parent::root(),
'/deeper-page'
'/l1-page'
);

$this->assertNotNull(
Expand Down
2 changes: 1 addition & 1 deletion tests/FileSystem/Files/PublicContentFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function can_check_existence(): void
$result
);

$sut = PublicContentFile::inRoot($root, '/deeper-page');
$sut = PublicContentFile::inRoot($root, '/l1-page');

$this->assertNotNull(
$sut
Expand Down
2 changes: 1 addition & 1 deletion tests/FileSystem/Files/PublicFileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function can_check_existence(): void
$result
);

$sut = PublicFile::inRoot($root, 'meta.json', '/deeper-page');
$sut = PublicFile::inRoot($root, 'meta.json', '/l1-page');

$this->assertNotNull(
$sut
Expand Down
4 changes: 2 additions & 2 deletions tests/ObjectsFromJson/PublicMetaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function can_get_content(): void
$result
);

$sut = PublicMeta::inRoot(parent::root(), '/deeper-page');
$sut = PublicMeta::inRoot(parent::root(), '/l1-page');

$expected = 1.0;

Expand All @@ -36,7 +36,7 @@ public function can_get_content(): void
$result
);

$sut = PublicMeta::inRoot(parent::root(), '/deeper-page');
$sut = PublicMeta::inRoot(parent::root(), '/l1-page');

$result = $sut->nonexistent();

Expand Down
2 changes: 1 addition & 1 deletion tests/PlainText/PrivateJsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function can_get_content(): void

$expected = '';

$sut = PrivateJson::inRoot(parent::root(), '/deeper-page');
$sut = PrivateJson::inRoot(parent::root(), '/l1-page');

$result = $sut->toString();

Expand Down
2 changes: 1 addition & 1 deletion tests/PlainText/PublicContentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function can_get_content(): void

$expected = '';

$sut = PublicContent::inRoot(parent::root(), '/deeper-page');
$sut = PublicContent::inRoot(parent::root(), '/l1-page');

$result = $sut->toString();

Expand Down
2 changes: 1 addition & 1 deletion tests/PlainText/PublicJsonTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public function can_get_content(): void

$expected = '';

$sut = PublicJson::inRoot(parent::root(), '/deeper-page');
$sut = PublicJson::inRoot(parent::root(), '/l1-page');

$result = $sut->toString();

Expand Down
4 changes: 2 additions & 2 deletions tests/PlainText/PublicMetaTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ public function can_get_content(): void

$expected = <<<json
{
"title": "Deeper page",
"title": "L1 page",
"created": "20230101",
"priority": 1.0
}

json;

$sut = PublicMeta::inRoot(parent::root(), '/deeper-page');
$sut = PublicMeta::inRoot(parent::root(), '/l1-page');

$result = $sut->toString();

Expand Down
7 changes: 4 additions & 3 deletions tests/SiteMapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class SiteMapTest extends TestCase
private function allPublicMetaFiles(): Traversable
{
return (new SymfonyFinder())->files()->name('meta.json')
->sortByName(true)
->in(
parent::publicRoot()->toString()
);
Expand All @@ -29,7 +30,7 @@ public function can_skip_sitemap(): void

$expected = <<<xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>http://ex.ample/deeper-page/</loc><lastmod>2023-01-01</lastmod><priority>1</priority></url><url><loc>http://ex.ample/</loc><priority>0.5</priority></url></urlset>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>http://ex.ample/l1-page/l2-page/</loc><lastmod>2023-01-01</lastmod><priority>1</priority></url><url><loc>http://ex.ample/l1-page/</loc><lastmod>2023-01-01</lastmod><priority>1</priority></url><url><loc>http://ex.ample/</loc><priority>0.5</priority></url></urlset>
xml;

$result = (string) Sitemap::create(
Expand All @@ -50,7 +51,7 @@ public function can_change_default_priority(): void
{
$expected = <<<xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>http://ex.ample/deeper-page/</loc><lastmod>2023-01-01</lastmod><priority>1</priority></url><url><loc>http://ex.ample/</loc><priority>0.75</priority></url></urlset>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>http://ex.ample/l1-page/l2-page/</loc><lastmod>2023-01-01</lastmod><priority>1</priority></url><url><loc>http://ex.ample/l1-page/</loc><lastmod>2023-01-01</lastmod><priority>1</priority></url><url><loc>http://ex.ample/</loc><priority>0.75</priority></url></urlset>
xml;

$result = (string) Sitemap::create(
Expand All @@ -71,7 +72,7 @@ public function is_expected_xml(): void
{
$expected = <<<xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>http://ex.ample/deeper-page/</loc><lastmod>2023-01-01</lastmod><priority>1</priority></url><url><loc>http://ex.ample/</loc><priority>0.5</priority></url></urlset>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"><url><loc>http://ex.ample/l1-page/l2-page/</loc><lastmod>2023-01-01</lastmod><priority>1</priority></url><url><loc>http://ex.ample/l1-page/</loc><lastmod>2023-01-01</lastmod><priority>1</priority></url><url><loc>http://ex.ample/</loc><priority>0.5</priority></url></urlset>
xml;

$result = (string) Sitemap::create(
Expand Down
4 changes: 2 additions & 2 deletions tests/SiteTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public function has_public_content(): void
public function has_titles(): void
{
$expected = [
'Deeper page',
'L1 page',
'Root test content'
];

$result = $this->site()->titles('/deeper-page');
$result = $this->site()->titles('/l1-page');

$this->assertSame(
$expected,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"title": "Deeper page",
"title": "L2 page",
"created": "20230101",
"priority": 1.0
}
5 changes: 5 additions & 0 deletions tests/test-content/public/l1-page/meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"title": "L1 page",
"created": "20230101",
"priority": 1.0
}
Loading