Skip to content

Commit

Permalink
Restructure Filters directory to be more informative
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Fedurtsya <[email protected]>
  • Loading branch information
Sieg committed Dec 31, 2023
1 parent e82ec14 commit 89b498f
Show file tree
Hide file tree
Showing 20 changed files with 87 additions and 77 deletions.
3 changes: 1 addition & 2 deletions services.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
imports:
- { resource: src/ChangeFilter/services.yaml }
- { resource: src/Integration/services.yaml }
- { resource: src/Repository/services.yaml }
- { resource: src/Sitemap/services.yaml }
- { resource: src/Settings/services.yaml }
- { resource: src/Sitemap/services.yaml }
- { resource: src/Url/services.yaml }

services:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

declare(strict_types=1);

namespace FreshAdvance\Sitemap\ChangeFilter;
namespace FreshAdvance\Sitemap\ChangeFilter\Category;

use FreshAdvance\Sitemap\ChangeFilter\Shared\ChangeFilterTemplate;
use FreshAdvance\Sitemap\Integration\Contract\ChangeFilterInterface;

class CategoryChangeFilter extends ChangeFilterTemplate implements ChangeFilterInterface
Expand Down
17 changes: 17 additions & 0 deletions src/ChangeFilter/Category/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
services:

_defaults:
public: false
autowire: true

FreshAdvance\Sitemap\ChangeFilter\Category\CategoryChangeFilter:
arguments:
$pageTypeConfiguration: '@FreshAdvance\Sitemap\Url\DataTypeFactory\CategoryUrlType'
$modelItemRepository: '@FreshAdvance\Sitemap\ChangeFilter\Category\CategoryChangeFilterItemRepository'
tags:
- 'sitemap.change_filter'

FreshAdvance\Sitemap\ChangeFilter\Category\CategoryChangeFilterItemRepository:
class: FreshAdvance\Sitemap\ChangeFilter\Shared\Repository\ModelItemRepository
arguments:
$model: '\OxidEsales\Eshop\Application\Model\Category'
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

declare(strict_types=1);

namespace FreshAdvance\Sitemap\ChangeFilter;
namespace FreshAdvance\Sitemap\ChangeFilter\Content;

use FreshAdvance\Sitemap\ChangeFilter\Shared\ChangeFilterTemplate;
use FreshAdvance\Sitemap\Integration\Contract\ChangeFilterInterface;

class ContentChangeFilter extends ChangeFilterTemplate implements ChangeFilterInterface
Expand Down
17 changes: 17 additions & 0 deletions src/ChangeFilter/Content/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
services:

_defaults:
public: false
autowire: true

FreshAdvance\Sitemap\ChangeFilter\Content\ContentChangeFilter:
arguments:
$pageTypeConfiguration: '@FreshAdvance\Sitemap\Url\DataTypeFactory\ContentUrlType'
$modelItemRepository: '@FreshAdvance\Sitemap\ChangeFilter\Content\ContentChangeFilterItemRepository'
tags:
- 'sitemap.change_filter'

FreshAdvance\Sitemap\ChangeFilter\Content\ContentChangeFilterItemRepository:
class: FreshAdvance\Sitemap\ChangeFilter\Shared\Repository\ModelItemRepository
arguments:
$model: '\OxidEsales\Eshop\Application\Model\Content'
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@

declare(strict_types=1);

namespace FreshAdvance\Sitemap\ChangeFilter;
namespace FreshAdvance\Sitemap\ChangeFilter\Product;

use FreshAdvance\Sitemap\ChangeFilter\Shared\ChangeFilterTemplate;
use FreshAdvance\Sitemap\Integration\Contract\ChangeFilterInterface;

class ProductChangeFilter extends ChangeFilterTemplate implements ChangeFilterInterface
Expand Down
17 changes: 17 additions & 0 deletions src/ChangeFilter/Product/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
services:

_defaults:
public: false
autowire: true

FreshAdvance\Sitemap\ChangeFilter\Product\ProductChangeFilter:
arguments:
$pageTypeConfiguration: '@FreshAdvance\Sitemap\Url\DataTypeFactory\ProductUrlType'
$modelItemRepository: '@FreshAdvance\Sitemap\ChangeFilter\Product\ProductChangeFilterItemRepository'
tags:
- 'sitemap.change_filter'

FreshAdvance\Sitemap\ChangeFilter\Product\ProductChangeFilterItemRepository:
class: FreshAdvance\Sitemap\ChangeFilter\Shared\Repository\ModelItemRepository
arguments:
$model: '\OxidEsales\Eshop\Application\Model\Article'
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

declare(strict_types=1);

namespace FreshAdvance\Sitemap\ChangeFilter;
namespace FreshAdvance\Sitemap\ChangeFilter\Shared;

use DateTime;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\ForwardCompatibility\Result;
use FreshAdvance\Sitemap\ChangeFilter\Shared\Repository\ModelItemRepositoryInterface;
use FreshAdvance\Sitemap\Integration\DataType\ObjectUrl;
use FreshAdvance\Sitemap\Repository\ModelItemRepositoryInterface;
use FreshAdvance\Sitemap\Url\DataType\UrlTypeInterface;
use Generator;
use OxidEsales\EshopCommunity\Internal\Framework\Database\ConnectionProviderInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

declare(strict_types=1);

namespace FreshAdvance\Sitemap\Repository;
namespace FreshAdvance\Sitemap\ChangeFilter\Shared\Repository;

use FreshAdvance\Sitemap\Integration\Exception\ModelItemNotFoundException;
use OxidEsales\Eshop\Core\Contract\IUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

declare(strict_types=1);

namespace FreshAdvance\Sitemap\Repository;
namespace FreshAdvance\Sitemap\ChangeFilter\Shared\Repository;

use OxidEsales\Eshop\Core\Contract\IUrl;
use OxidEsales\Eshop\Core\Model\BaseModel;
Expand Down
30 changes: 4 additions & 26 deletions src/ChangeFilter/services.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,4 @@
services:

_defaults:
public: false
autowire: true

FreshAdvance\Sitemap\ChangeFilter\ContentChangeFilter:
arguments:
$pageTypeConfiguration: '@FreshAdvance\Sitemap\Url\DataTypeFactory\ContentUrlType'
$modelItemRepository: '@FreshAdvance\Sitemap\Repository\ContentModelItemRepository'
tags:
- 'sitemap.change_filter'

FreshAdvance\Sitemap\ChangeFilter\ProductChangeFilter:
arguments:
$pageTypeConfiguration: '@FreshAdvance\Sitemap\Url\DataTypeFactory\ProductUrlType'
$modelItemRepository: '@FreshAdvance\Sitemap\Repository\ProductModelItemRepository'
tags:
- 'sitemap.change_filter'

FreshAdvance\Sitemap\ChangeFilter\CategoryChangeFilter:
arguments:
$pageTypeConfiguration: '@FreshAdvance\Sitemap\Url\DataTypeFactory\CategoryUrlType'
$modelItemRepository: '@FreshAdvance\Sitemap\Repository\CategoryModelItemRepository'
tags:
- 'sitemap.change_filter'
imports:
- { resource: Category/services.yaml }
- { resource: Content/services.yaml }
- { resource: Product/services.yaml }
20 changes: 0 additions & 20 deletions src/Repository/services.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

declare(strict_types=1);

namespace FreshAdvance\Sitemap\Tests\Integration\ChangeFilter;
namespace FreshAdvance\Sitemap\Tests\Integration\ChangeFilter\Category;

use DateTime;
use FreshAdvance\Sitemap\ChangeFilter\CategoryChangeFilter;
use FreshAdvance\Sitemap\ChangeFilter\Category\CategoryChangeFilter;
use FreshAdvance\Sitemap\Integration\DataType\ObjectUrlInterface;
use FreshAdvance\Sitemap\Tests\Integration\IntegrationTestCase;
use OxidEsales\Eshop\Application\Model\Category;

/**
* @covers \FreshAdvance\Sitemap\ChangeFilter\ChangeFilterTemplate
* @covers \FreshAdvance\Sitemap\ChangeFilter\CategoryChangeFilter
* @covers \FreshAdvance\Sitemap\ChangeFilter\Shared\ChangeFilterTemplate
* @covers \FreshAdvance\Sitemap\ChangeFilter\Category\CategoryChangeFilter
*/
class CategoryChangeFilterTest extends IntegrationTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

declare(strict_types=1);

namespace FreshAdvance\Sitemap\Tests\Integration\ChangeFilter;
namespace FreshAdvance\Sitemap\Tests\Integration\ChangeFilter\Content;

use DateTime;
use FreshAdvance\Sitemap\ChangeFilter\ContentChangeFilter;
use FreshAdvance\Sitemap\ChangeFilter\Content\ContentChangeFilter;
use FreshAdvance\Sitemap\Integration\DataType\ObjectUrlInterface;
use FreshAdvance\Sitemap\Tests\Integration\IntegrationTestCase;
use OxidEsales\EshopCommunity\Application\Model\Content;

/**
* @covers \FreshAdvance\Sitemap\ChangeFilter\ChangeFilterTemplate
* @covers \FreshAdvance\Sitemap\ChangeFilter\ContentChangeFilter
* @covers \FreshAdvance\Sitemap\ChangeFilter\Shared\ChangeFilterTemplate
* @covers \FreshAdvance\Sitemap\ChangeFilter\Content\ContentChangeFilter
*/
class ContentChangeFilterTest extends IntegrationTestCase
{
Expand All @@ -34,8 +34,8 @@ public function testCheckCurrentUrlItem(): void
$this->createExampleContent('example4', false, 'CMSFOLDER_USERINFO');
$this->createExampleContent('example5', true, 'CMSFOLDER_USERINFO');

/** @var ContentChangeFilter $sut */
$sut = $this->get(ContentChangeFilter::class);
/** @var \FreshAdvance\Sitemap\ChangeFilter\Content\ContentChangeFilter $sut */
$sut = $this->get(\FreshAdvance\Sitemap\ChangeFilter\Content\ContentChangeFilter::class);
$urls = $sut->getUpdatedUrls(3);

$this->checkCurrentUrlItem($urls->current(), 'example1');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

declare(strict_types=1);

namespace FreshAdvance\Sitemap\Tests\Integration\ChangeFilter;
namespace FreshAdvance\Sitemap\Tests\Integration\ChangeFilter\Product;

use DateTime;
use FreshAdvance\Sitemap\ChangeFilter\ProductChangeFilter;
use FreshAdvance\Sitemap\ChangeFilter\Product\ProductChangeFilter;
use FreshAdvance\Sitemap\Integration\DataType\ObjectUrlInterface;
use FreshAdvance\Sitemap\Tests\Integration\IntegrationTestCase;
use OxidEsales\Eshop\Application\Model\Article;

/**
* @covers \FreshAdvance\Sitemap\ChangeFilter\ChangeFilterTemplate
* @covers \FreshAdvance\Sitemap\ChangeFilter\ProductChangeFilter
* @covers \FreshAdvance\Sitemap\ChangeFilter\Shared\ChangeFilterTemplate
* @covers \FreshAdvance\Sitemap\ChangeFilter\Product\ProductChangeFilter
*/
class ProductChangeFilterTest extends IntegrationTestCase
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@

declare(strict_types=1);

namespace FreshAdvance\Sitemap\Tests\Integration\Repository;
namespace FreshAdvance\Sitemap\Tests\Integration\ChangeFilter\Shared\Repository;

use FreshAdvance\Sitemap\Integration\Exception\ModelItemNotFoundException;
use FreshAdvance\Sitemap\Repository\ModelItemRepository;
use FreshAdvance\Sitemap\Tests\Integration\IntegrationTestCase;
use Generator;
use OxidEsales\Eshop\Application\Model\Article;
Expand All @@ -25,7 +24,7 @@ public function testGetItem(string $model, string $filler): void
$identifier = uniqid();
$this->$filler($identifier);

$sut = new ModelItemRepository(model: $model);
$sut = new \FreshAdvance\Sitemap\ChangeFilter\Shared\Repository\ModelItemRepository(model: $model);
$item = $sut->getItem($identifier);

$this->assertTrue($item->isLoaded());
Expand All @@ -51,7 +50,7 @@ public function getItemDataProvider(): Generator

public function testLoadingFailureThrowsException(): void
{
$sut = new ModelItemRepository(model: Content::class);
$sut = new \FreshAdvance\Sitemap\ChangeFilter\Shared\Repository\ModelItemRepository(model: Content::class);

$this->expectException(ModelItemNotFoundException::class);
$sut->getItem(uniqid());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

declare(strict_types=1);

namespace Command;
namespace FreshAdvance\Sitemap\Tests\Integration\Integration\Command;

use FreshAdvance\Sitemap\Integration\Service\Synchronizer;
use PHPUnit\Framework\TestCase;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

declare(strict_types=1);

namespace FreshAdvance\Sitemap\Tests\Unit\DataStructure;
namespace FreshAdvance\Sitemap\Tests\Unit\Integration\DataType;

use DateTime;
use FreshAdvance\Sitemap\Integration\DataType\ObjectUrl;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

declare(strict_types=1);

namespace ChangeFilter;
namespace FreshAdvance\Sitemap\Tests\Unit\Integration\Service;

use FreshAdvance\Sitemap\Integration\Contract\ChangeFilterInterface;
use FreshAdvance\Sitemap\Integration\Exception\FilterConfigurationException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

declare(strict_types=1);

namespace FreshAdvance\Sitemap\Tests\Unit\Service;
namespace FreshAdvance\Sitemap\Tests\Unit\Integration\Service;

use FreshAdvance\Sitemap\Integration\Contract\ChangeFilterInterface;
use FreshAdvance\Sitemap\Integration\DataType\ObjectUrlInterface;
Expand Down

0 comments on commit 89b498f

Please sign in to comment.