Skip to content

Commit e48c815

Browse files
committed
Update to b-7.1.x shop and 11.5 phpunit
Signed-off-by: Anton Fedurtsya <[email protected]>
1 parent 3b3f70c commit e48c815

28 files changed

+76
-110
lines changed

.github/workflows/dispatch_module.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ on:
77
type: choice
88
options:
99
- 'no'
10-
- 'PHP8.0/MySQL5.7'
11-
- 'PHP8.0/MySQL8.0'
1210
- 'PHP8.1/MySQL5.7'
1311
- 'PHP8.1/MySQL8.0'
14-
default: 'PHP8.1/MySQL8.0'
12+
- 'PHP8.2/MySQL5.7'
13+
- 'PHP8.2/MySQL8.0'
14+
default: 'PHP8.2/MySQL8.0'
1515
description: 'Limit to one PHP/MySQL combination'
1616

1717
jobs:
@@ -26,14 +26,14 @@ jobs:
2626
# shellcheck disable=SC2088
2727
case "${{ inputs.limit }}" in
2828
"no") LIMIT='';;
29-
"PHP8.0/MySQL5.7") LIMIT='~/defaults/php8.0_mysql5.7_only.yml,' ;;
30-
"PHP8.0/MySQL8.0") LIMIT='~/defaults/php8.0_mysql8.0_only.yml,' ;;
3129
"PHP8.1/MySQL5.7") LIMIT='~/defaults/php8.1_mysql5.7_only.yml,' ;;
3230
"PHP8.1/MySQL8.0") LIMIT='~/defaults/php8.1_mysql8.0_only.yml,' ;;
31+
"PHP8.2/MySQL5.7") LIMIT='~/defaults/php8.2_mysql5.7_only.yml,' ;;
32+
"PHP8.2/MySQL8.0") LIMIT='~/defaults/php8.2_mysql8.0_only.yml,' ;;
3333
esac
3434
3535
# shellcheck disable=SC2088
36-
TESTPLAN="~/defaults/7.0.x.yml,${LIMIT}~/module-sitemap.yaml"
36+
TESTPLAN="~/defaults/7.1.x.yml,${LIMIT}~/module-sitemap.yaml"
3737
echo "testplan=${TESTPLAN}" | tee -a "${GITHUB_OUTPUT}"
3838
3939
dispatch_stable:

.github/workflows/trigger.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ on:
55
pull_request: {}
66
push:
77
branches:
8-
- 'b-*'
8+
- 'b-7.1.x'
99

1010
jobs:
1111
php81_mysql80:
1212
uses: oxid-eSales/github-actions/.github/workflows/universal_workflow_light.yml@v4
1313
with:
14-
testplan: '~/defaults/7.0.x.yml,~/defaults/php8.1_mysql8.0_only.yml,~/module-sitemap.yaml'
14+
testplan: '~/defaults/7.1.x.yml,~/defaults/php8.2_mysql8.0_only.yml,~/module-sitemap.yaml'
1515
runs_on: '"ubuntu-latest"'
1616
defaults: 'v4'
1717
plan_folder: '.github/fresh-advance'

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](http://keepachangelog.com/)
55
and this project adheres to [Semantic Versioning](http://semver.org/).
66

7+
## [v1.1.0] - Unreleased
8+
9+
### Added
10+
- Upgraded the phpunit to 11.5
11+
12+
### Fixed
13+
- Notices if sitemap directory does not exist
14+
15+
### Removed
16+
- PHP 8.1 support
17+
718
## [v1.0.3] - Unreleased
819

920
### Fixed

README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Fresh-Advance_Sitemap&metric=coverage)](https://sonarcloud.io/dashboard?id=Fresh-Advance_Sitemap)
99
[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=Fresh-Advance_Sitemap&metric=sqale_index)](https://sonarcloud.io/dashboard?id=Fresh-Advance_Sitemap)
1010

11-
**In development**
12-
1311
## The idea
1412

1513
There is a table (fa_sitemap) which will contain the list of all sitemap urls.
@@ -33,8 +31,13 @@ The sitemap files are generated by "fa:sitemap:generate" command.
3331
* Multishop support
3432
* Configurable step size for update run
3533

36-
## Compatibility
34+
## Version compatibility
35+
36+
* v1.0.x is compatible with OXID Shop compilation 7.0 and up
37+
38+
## Branch compatibility
3739

40+
* Branch b-7.1.x is compatible with OXID Shop compilation 7.1.0 and up
3841
* Branch b-7.0.x is compatible with OXID Shop compilation 7.0.0-rc.2 and up
3942

4043
## Installation
@@ -43,6 +46,7 @@ Module is available on packagist. Install it via composer and activate the modul
4346

4447
```
4548
composer require fresh-advance/sitemap:^v1.0.0
49+
vendor/bin/oe-eshop-doctrine_migration migrations:migrate fa_sitemap
4650
vendor/bin/oe-console oe:module:activate fa_sitemap
4751
```
4852

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
"minimum-stability": "dev",
1212
"prefer-stable": true,
1313
"require": {
14-
"php": "^8.0",
14+
"php": ">8.2",
1515
"oxid-esales/oxideshop-ce": "*"
1616
},
1717
"conflict": {
18-
"oxid-esales/oxideshop-ce": "<7.0.0-rc.2"
18+
"oxid-esales/oxideshop-ce": "<7.1.0"
1919
},
2020
"require-dev": {
21-
"phpunit/phpunit": "^9.5",
21+
"phpunit/phpunit": "^11.5",
2222
"phpstan/phpstan": "^1.8.10",
2323
"squizlabs/php_codesniffer": "3.*",
2424
"phpmd/phpmd": "^2.11",
@@ -28,9 +28,9 @@
2828
"codeception/module-db": "^3.0",
2929
"codeception/module-filesystem": "^3.0",
3030
"codeception/module-webdriver": "^3.1",
31-
"oxid-esales/codeception-modules": "dev-b-7.0.x",
32-
"oxid-esales/codeception-page-objects": "dev-b-7.0.x",
33-
"oxid-esales/developer-tools": "dev-b-7.0.x"
31+
"oxid-esales/codeception-modules": "dev-b-7.1.x",
32+
"oxid-esales/codeception-page-objects": "dev-b-7.1.x",
33+
"oxid-esales/developer-tools": "dev-b-7.1.x"
3434
},
3535
"autoload": {
3636
"psr-4": {

src/Sitemap/Service/Filesystem.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ public function createSitemapFile(string $directory, string $fileName, string $c
2626

2727
public function cleanupSitemapFiles(string $directory): void
2828
{
29-
$allFiles = scandir($directory);
29+
if (is_dir($directory)) {
30+
$allFiles = scandir($directory);
31+
}
3032

31-
if (!is_array($allFiles)) {
32-
throw new SitemapDirectoryAccessException();
33+
if (!isset($allFiles) || !is_array($allFiles)) {
34+
throw new SitemapDirectoryAccessException('Directory is not readable');
3335
}
3436

3537
foreach ($allFiles as $oneFile) {

tests/Integration/ChangeFilter/Category/CategoryChangeFilterTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
use FreshAdvance\Sitemap\Tests\Integration\IntegrationTestCase;
1616
use OxidEsales\Eshop\Application\Model\Category;
1717

18-
/**
19-
* @covers \FreshAdvance\Sitemap\ChangeFilter\Shared\DatabaseChangeFilter
20-
* @covers \FreshAdvance\Sitemap\ChangeFilter\Category\CategoryChangeFilter
21-
*/
2218
class CategoryChangeFilterTest extends IntegrationTestCase
2319
{
2420
protected string $objectType = 'category';

tests/Integration/ChangeFilter/Content/ContentChangeFilterTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
use FreshAdvance\Sitemap\Tests\Integration\IntegrationTestCase;
1616
use OxidEsales\EshopCommunity\Application\Model\Content;
1717

18-
/**
19-
* @covers \FreshAdvance\Sitemap\ChangeFilter\Shared\DatabaseChangeFilter
20-
* @covers \FreshAdvance\Sitemap\ChangeFilter\Content\ContentChangeFilter
21-
*/
2218
class ContentChangeFilterTest extends IntegrationTestCase
2319
{
2420
protected string $objectType = 'content';

tests/Integration/ChangeFilter/Product/ProductChangeFilterTest.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
use FreshAdvance\Sitemap\Tests\Integration\IntegrationTestCase;
1616
use OxidEsales\Eshop\Application\Model\Article;
1717

18-
/**
19-
* @covers \FreshAdvance\Sitemap\ChangeFilter\Shared\DatabaseChangeFilter
20-
* @covers \FreshAdvance\Sitemap\ChangeFilter\Product\ProductChangeFilter
21-
*/
2218
class ProductChangeFilterTest extends IntegrationTestCase
2319
{
2420
protected string $objectType = 'product';

tests/Integration/ChangeFilter/Shared/Repository/ModelItemRepositoryTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@
1515
use OxidEsales\Eshop\Application\Model\Article;
1616
use OxidEsales\Eshop\Application\Model\Category;
1717
use OxidEsales\Eshop\Application\Model\Content;
18+
use PHPUnit\Framework\Attributes\DataProvider;
1819

1920
class ModelItemRepositoryTest extends IntegrationTestCase
2021
{
21-
/** @dataProvider getItemDataProvider */
22+
#[DataProvider('getItemDataProvider')]
2223
public function testGetItem(string $model, string $filler): void
2324
{
2425
$identifier = uniqid();
@@ -30,7 +31,7 @@ public function testGetItem(string $model, string $filler): void
3031
$this->assertTrue($item->isLoaded());
3132
}
3233

33-
public function getItemDataProvider(): Generator
34+
public static function getItemDataProvider(): Generator
3435
{
3536
yield [
3637
'model' => Content::class,

tests/Integration/Integration/Command/UpdateAllTypesCommandTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
use PHPUnit\Framework\TestCase;
1818
use Symfony\Component\Console\Tester\CommandTester;
1919

20-
/**
21-
* @covers \FreshAdvance\Sitemap\Integration\Command\UpdateAllTypesCommand
22-
*/
2320
class UpdateAllTypesCommandTest extends TestCase
2421
{
2522
public function testUpdateAllTypes(): void

tests/Integration/Integration/Command/UpdateTypeCommandTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
use PHPUnit\Framework\TestCase;
1818
use Symfony\Component\Console\Tester\CommandTester;
1919

20-
/**
21-
* @covers \FreshAdvance\Sitemap\Integration\Command\UpdateTypeCommand
22-
*/
2320
class UpdateTypeCommandTest extends TestCase
2421
{
2522
public function testUpdateTypeUrls(): void

tests/Integration/Integration/Service/FilterFactoryTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
use FreshAdvance\Sitemap\Integration\Service\FilterFactoryInterface;
1313
use FreshAdvance\Sitemap\Tests\Integration\IntegrationTestCase;
1414

15-
/**
16-
* @covers \FreshAdvance\Sitemap\Integration\Service\FilterFactory
17-
*/
1815
class FilterFactoryTest extends IntegrationTestCase
1916
{
2017
public function testInitialization(): void

tests/Integration/Sitemap/Command/GenerateSitemapCommandTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Component\Console\Tester\CommandTester;
1616

17-
/**
18-
* @covers \FreshAdvance\Sitemap\Sitemap\Command\GenerateSitemapCommand
19-
*/
2017
class GenerateSitemapCommandTest extends TestCase
2118
{
2219
public function testCallSitemapCreationService(): void

tests/Integration/Url/DataTypeFactory/UrlTypeFactoryTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212
use FreshAdvance\Sitemap\Tests\Integration\IntegrationTestCase;
1313
use FreshAdvance\Sitemap\Url\DataTypeFactory\UrlTypeFactoryInterface;
1414

15-
/**
16-
* @covers \FreshAdvance\Sitemap\Url\DataTypeFactory\UrlTypeFactory
17-
*/
1815
class UrlTypeFactoryTest extends IntegrationTestCase
1916
{
2017
public function testInitialization(): void

tests/Integration/Url/Repository/UrlRepositoryTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
use FreshAdvance\Sitemap\Url\Repository\UrlRepository;
1717
use FreshAdvance\Sitemap\Url\Repository\UrlRepositoryInterface;
1818

19-
/**
20-
* @covers \FreshAdvance\Sitemap\Url\Repository\UrlRepository
21-
*/
2219
class UrlRepositoryTest extends IntegrationTestCase
2320
{
2421
public function testSaveAndThenGetUrl(): void
@@ -88,9 +85,9 @@ public function testDeleteByIds(): void
8885
$connection->executeQuery("delete from fa_sitemap");
8986
$connection->executeQuery(
9087
"insert into fa_sitemap (id, object_id, location, object_type) values
91-
(998, 'firstobject', 'somelocation1', '{$this->objectType}'),
92-
(999, 'secondobject', 'somelocation2', '{$this->objectType}'),
93-
(1000, 'thirdobject', 'somelocation3', '{$this->objectType}'),
88+
(998, 'firstobject', 'somelocation1', '{uniqid()}'),
89+
(999, 'secondobject', 'somelocation2', '{uniqid()}'),
90+
(1000, 'thirdobject', 'somelocation3', '{uniqid()}'),
9491
(1001, 'fourthobject', 'somelocation4', 'not content')"
9592
);
9693

tests/Unit/ChangeFilter/Shared/BaseChangeFilterTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@
1212
use FreshAdvance\Sitemap\ChangeFilter\Shared\BaseChangeFilter;
1313
use PHPUnit\Framework\TestCase;
1414

15-
/**
16-
* @covers \FreshAdvance\Sitemap\ChangeFilter\Shared\BaseChangeFilter
17-
*/
1815
class BaseChangeFilterTest extends TestCase
1916
{
2017
public function testGetObjectType(): void
2118
{
2219
$objectType = uniqid();
2320

24-
$sut = $this->getMockForAbstractClass(BaseChangeFilter::class, [$objectType]);
21+
$sut = $this->getMockBuilder(BaseChangeFilter::class)
22+
->setConstructorArgs([$objectType])
23+
->onlyMethods(['getUpdatedUrls', 'getDisabledUrlIds'])
24+
->getMock();
2525

2626
$this->assertSame($objectType, $sut->getObjectType());
2727
}

tests/Unit/Integration/DataType/ObjectUrlTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
use FreshAdvance\Sitemap\Integration\DataType\ObjectUrl;
1414
use PHPUnit\Framework\TestCase;
1515

16-
/**
17-
* @covers \FreshAdvance\Sitemap\Integration\DataType\ObjectUrl
18-
*/
1916
class ObjectUrlTest extends TestCase
2017
{
2118
public function testMainGetters(): void

tests/Unit/Integration/Service/FilterFactoryTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
use PHPUnit\Framework\TestCase;
1717
use stdClass;
1818

19-
/**
20-
* @covers \FreshAdvance\Sitemap\Integration\Service\FilterFactory
21-
*/
2219
class FilterFactoryTest extends TestCase
2320
{
2421
public function testGetFilter(): void

tests/Unit/Integration/Service/SynchronizerTest.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
use Generator;
1818
use PHPUnit\Framework\TestCase;
1919

20-
/**
21-
* @covers \FreshAdvance\Sitemap\Integration\Service\Synchronizer
22-
*/
2320
class SynchronizerTest extends TestCase
2421
{
2522
public function testUpdateIteratesOverUrlsAndUpdatesThemThroughRepository(): void
@@ -44,7 +41,7 @@ function (
4441
$objectUrlStub1,
4542
$objectUrlStub2
4643
) {
47-
switch ($matcher->getInvocationCount()) {
44+
switch ($matcher->numberOfInvocations()) {
4845
case "1":
4946
$this->assertEquals($objectUrlStub1, $objectUrl);
5047
break;

tests/Unit/Settings/ShopSettingsTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
use OxidEsales\Eshop\Core\Config;
1414
use PHPUnit\Framework\TestCase;
1515

16-
/**
17-
* @covers \FreshAdvance\Sitemap\Settings\ShopSettings
18-
*/
1916
class ShopSettingsTest extends TestCase
2017
{
2118
public function testGetShopUrl(): void

tests/Unit/Sitemap/DataType/SitemapUrlTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@
1313
use FreshAdvance\Sitemap\Sitemap\DataType\SitemapUrl;
1414
use PHPUnit\Framework\TestCase;
1515

16-
/**
17-
* @covers \FreshAdvance\Sitemap\Sitemap\DataType\SitemapUrl
18-
*/
1916
class SitemapUrlTest extends TestCase
2017
{
2118
public function testMainGetters(): void

tests/Unit/Sitemap/Service/FilesystemTest.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@
1414
use org\bovigo\vfs\vfsStream;
1515
use PHPUnit\Framework\TestCase;
1616

17-
/**
18-
* @covers \FreshAdvance\Sitemap\Sitemap\Service\Filesystem
19-
*/
2017
class FilesystemTest extends TestCase
2118
{
2219
public function testCreateSitemapFile(): void

0 commit comments

Comments
 (0)