Skip to content

Commit

Permalink
Fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
jordisala1991 authored and github-actions[bot] committed May 9, 2023
1 parent c87314e commit 382d90f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/Writer/SitemapWriter.php
Expand Up @@ -253,7 +253,13 @@ private function fixDataType(array &$data): void
*/
private function generateDefaultLine(array $data): string
{
return sprintf(' <url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%s</priority></url>'."\n", $data['url'], date('Y-m-d', strtotime($data['lastmod'])), $data['changefreq'], $data['priority']);
return sprintf(
' <url><loc>%s</loc><lastmod>%s</lastmod><changefreq>%s</changefreq><priority>%s</priority></url>'."\n",
$data['url'],
(new \DateTime($data['lastmod']))->format('Y-m-d'),
$data['changefreq'],
$data['priority']
);
}

/**
Expand Down
10 changes: 8 additions & 2 deletions tests/Writer/SitemapWriterTest.php
Expand Up @@ -195,8 +195,14 @@ public function testLimitUrl(): void
static::assertNotFalse($info);

static::assertLessThan(SitemapWriter::LIMIT_SIZE, $info['size']);
static::assertCount(SitemapWriter::LIMIT_URL, $file1->children());
static::assertCount(1, iterator_to_array($file2->children()));

$file1Children = $file1->children();
$file2Children = $file2->children();

static::assertNotNull($file1Children);
static::assertNotNull($file2Children);
static::assertCount(SitemapWriter::LIMIT_URL, $file1Children);
static::assertCount(1, iterator_to_array($file2Children));
}

/**
Expand Down

0 comments on commit 382d90f

Please sign in to comment.