Skip to content

Commit

Permalink
Merge 3.x into 4.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI committed May 10, 2023
2 parents 0b3a012 + 382d90f commit c089242
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 8 deletions.
1 change: 0 additions & 1 deletion .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
uses: ramsey/composer-install@v2
with:
dependency-versions: highest
composer-options: --prefer-dist --prefer-stable

- name: Lint PHP files
run: make lint-php
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/qa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:
uses: ramsey/composer-install@v2
with:
dependency-versions: highest
composer-options: --prefer-dist --prefer-stable

- name: PHPStan
run: vendor/bin/phpstan --no-progress --memory-limit=1G analyse --error-format=github
Expand All @@ -64,7 +63,6 @@ jobs:
uses: ramsey/composer-install@v2
with:
dependency-versions: highest
composer-options: --prefer-dist --prefer-stable

- name: Psalm
run: vendor/bin/psalm --no-progress --show-info=false --stats --output-format=github --threads=$(nproc) --shepherd --php-version=8.2
Expand All @@ -90,7 +88,6 @@ jobs:
uses: ramsey/composer-install@v2
with:
dependency-versions: highest
composer-options: --prefer-dist --prefer-stable

- name: Rector
run: vendor/bin/rector --no-progress-bar --dry-run
6 changes: 5 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ jobs:
allowed-to-fail: false
symfony-require: 6.2.*
variant: symfony/symfony:"6.2.*"
- php-version: '8.2'
dependencies: highest
allowed-to-fail: false
symfony-require: 6.3.*
variant: symfony/symfony:"6.3.*"

steps:
- name: Checkout
Expand Down Expand Up @@ -88,7 +93,6 @@ jobs:
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.dependencies }}
composer-options: --prefer-dist --prefer-stable

- name: Run Tests with coverage
run: make coverage
Expand Down
2 changes: 2 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@
"symfony/property-access": "To be able to export from database entities",
"symfony/routing": "To be able to export the routes of a Symfony app"
},
"minimum-stability": "dev",
"prefer-stable": true,
"autoload": {
"psr-4": {
"Sonata\\Exporter\\": "src/",
Expand Down
8 changes: 7 additions & 1 deletion src/Writer/SitemapWriter.php
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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 c089242

Please sign in to comment.