Skip to content

Commit

Permalink
Merge tag v2.3.19 into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
roadiz-ci committed Jul 12, 2024
1 parent 9fcbb32 commit efa82ee
Show file tree
Hide file tree
Showing 12 changed files with 35 additions and 42 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,4 @@ jobs:
- name: Run PHPStan
run: vendor/bin/phpstan analyse --no-progress -c phpstan.neon
- name: Run unit tests
run: vendor/bin/phpunit -v --whitelist ./src --coverage-clover ./build/logs/clover.xml src/Test
run: vendor/bin/phpunit -v --whitelist ./src tests
4 changes: 0 additions & 4 deletions Makefile

This file was deleted.

8 changes: 6 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@
},
"autoload": {
"psr-4": {
"RZ\\Roadiz\\EntityGenerator\\": "src/",
"tests\\mocks\\": "tests/mocks/"
"RZ\\Roadiz\\EntityGenerator\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"RZ\\Roadiz\\EntityGenerator\\Tests\\": "tests/"
}
},
"require-dev": {
Expand Down
13 changes: 3 additions & 10 deletions src/EntityGeneratorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,11 @@

final class EntityGeneratorFactory
{
private NodeTypeResolverInterface $nodeTypeResolverBag;
private DefaultValuesResolverInterface $defaultValuesResolver;
private array $options;

public function __construct(
NodeTypeResolverInterface $nodeTypeResolverBag,
DefaultValuesResolverInterface $defaultValuesResolver,
array $options
private readonly NodeTypeResolverInterface $nodeTypeResolverBag,
private readonly DefaultValuesResolverInterface $defaultValuesResolver,
private readonly array $options
) {
$this->nodeTypeResolverBag = $nodeTypeResolverBag;
$this->defaultValuesResolver = $defaultValuesResolver;
$this->options = $options;
}

public function create(NodeTypeInterface $nodeType): EntityGeneratorInterface
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace RZ\Roadiz\EntityGenerator\Test;
namespace RZ\Roadiz\EntityGenerator\Tests;

use PHPUnit\Framework\TestCase;
use RZ\Roadiz\EntityGenerator\EntityGeneratorFactory;
Expand All @@ -25,7 +25,7 @@ protected function getEntityGeneratorFactory(?array $options = null): EntityGene
'custom_form_class' => '\mock\Entity\CustomForm',
'custom_form_proxy_class' => '\mock\Entity\NodesSourcesCustomForm',
'repository_class' => '\mock\Entity\Repository\NodesSourcesRepository',
'namespace' => '\tests\mocks\GeneratedNodesSources',
'namespace' => '\RZ\Roadiz\EntityGenerator\Tests\Mocks\GeneratedNodesSources',
'use_native_json' => true,
'use_api_platform_filters' => true,
]
Expand All @@ -37,7 +37,7 @@ public function testCreate(): void
$generator = $this->getEntityGeneratorFactory();

$this->assertEquals(
file_get_contents(dirname(__DIR__) . '/../tests/mocks/GeneratedNodesSources/NSMock.php'),
file_get_contents(dirname(__DIR__) . '/tests/Mocks/GeneratedNodesSources/NSMock.php'),
$generator->create($this->getMockNodeType())->getClassContent()
);
}
Expand All @@ -53,7 +53,7 @@ public function testCreateWithCustomRepository(): void
'custom_form_class' => '\mock\Entity\CustomForm',
'custom_form_proxy_class' => '\mock\Entity\NodesSourcesCustomForm',
'repository_class' => '\mock\Entity\Repository\NodesSourcesRepository',
'namespace' => '\tests\mocks\GeneratedNodesSourcesWithRepository',
'namespace' => '\RZ\Roadiz\EntityGenerator\Tests\Mocks\GeneratedNodesSourcesWithRepository',
'use_native_json' => true,
'use_api_platform_filters' => true,
]);
Expand All @@ -67,7 +67,7 @@ public function testCreateWithCustomRepository(): void
// );

$this->assertEquals(
file_get_contents(dirname(__DIR__) . '/../tests/mocks/GeneratedNodesSourcesWithRepository/NSMock.php'),
file_get_contents(dirname(__DIR__) . '/tests/Mocks/GeneratedNodesSourcesWithRepository/NSMock.php'),
$generator->createWithCustomRepository($this->getMockNodeType())->getClassContent()
);
}
Expand All @@ -83,7 +83,7 @@ public function testCreateCustomRepository(): void
'custom_form_class' => '\mock\Entity\CustomForm',
'custom_form_proxy_class' => '\mock\Entity\NodesSourcesCustomForm',
'repository_class' => '\mock\Entity\Repository\NodesSourcesRepository',
'namespace' => '\tests\mocks\GeneratedNodesSourcesWithRepository',
'namespace' => '\RZ\Roadiz\EntityGenerator\Tests\Mocks\GeneratedNodesSourcesWithRepository',
'use_native_json' => true,
'use_api_platform_filters' => true,
]);
Expand All @@ -97,7 +97,7 @@ public function testCreateCustomRepository(): void
// );

$this->assertEquals(
file_get_contents(dirname(__DIR__) . '/../tests/mocks/GeneratedNodesSourcesWithRepository/NSMockRepository.php'),
file_get_contents(dirname(__DIR__) . '/tests/Mocks/GeneratedNodesSourcesWithRepository/Repository/NSMockRepository.php'),
$generator->createCustomRepository($this->getMockNodeType())->getClassContent()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace RZ\Roadiz\EntityGenerator\Test;
namespace RZ\Roadiz\EntityGenerator\Tests;

use PHPUnit\Framework\TestCase;
use RZ\Roadiz\Contracts\NodeType\NodeTypeInterface;
Expand All @@ -27,7 +27,7 @@ protected function getEntityGenerator(NodeTypeInterface $nodeType, ?array $optio
'custom_form_class' => '\mock\Entity\CustomForm',
'custom_form_proxy_class' => '\mock\Entity\NodesSourcesCustomForm',
'repository_class' => '\mock\Entity\Repository\NodesSourcesRepository',
'namespace' => '\tests\mocks\GeneratedNodesSources',
'namespace' => '\RZ\Roadiz\EntityGenerator\Tests\Mocks\GeneratedNodesSources',
'use_native_json' => true,
'use_api_platform_filters' => true,
]
Expand All @@ -48,7 +48,7 @@ public function testGetClassContent(): void
// );

$this->assertEquals(
file_get_contents(dirname(__DIR__) . '/../tests/mocks/GeneratedNodesSources/NSMock.php'),
file_get_contents(dirname(__DIR__) . '/tests/Mocks/GeneratedNodesSources/NSMock.php'),
$generator->getClassContent()
);

Expand All @@ -64,12 +64,12 @@ public function testGetClassContent(): void
'custom_form_class' => 'mock\Entity\CustomForm',
'custom_form_proxy_class' => 'mock\Entity\NodesSourcesCustomForm',
'repository_class' => 'mock\Entity\Repository\NodesSourcesRepository',
'namespace' => 'tests\mocks\GeneratedNodesSources',
'namespace' => 'RZ\Roadiz\EntityGenerator\Tests\Mocks\GeneratedNodesSources',
'use_native_json' => true,
'use_api_platform_filters' => true,
]);
$this->assertEquals(
file_get_contents(dirname(__DIR__) . '/../tests/mocks/GeneratedNodesSources/NSMock.php'),
file_get_contents(dirname(__DIR__) . '/tests/Mocks/GeneratedNodesSources/NSMock.php'),
$generatorWithoutLeadingSlashes->getClassContent()
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace RZ\Roadiz\EntityGenerator\Test;
namespace RZ\Roadiz\EntityGenerator\Tests;

use RZ\Roadiz\Contracts\NodeType\NodeTypeFieldInterface;
use RZ\Roadiz\EntityGenerator\Field\DefaultValuesResolverInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* THIS IS A GENERATED FILE, DO NOT EDIT IT
* IT WILL BE RECREATED AT EACH NODE-TYPE UPDATE
*/
namespace tests\mocks\GeneratedNodesSources;
namespace RZ\Roadiz\EntityGenerator\Tests\Mocks\GeneratedNodesSources;

use Doctrine\Common\Collections\Collection;
use JMS\Serializer\Annotation as Serializer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* THIS IS A GENERATED FILE, DO NOT EDIT IT
* IT WILL BE RECREATED AT EACH NODE-TYPE UPDATE
*/
namespace tests\mocks\GeneratedNodesSourcesWithRepository;
namespace RZ\Roadiz\EntityGenerator\Tests\Mocks\GeneratedNodesSourcesWithRepository;

use Doctrine\Common\Collections\Collection;
use JMS\Serializer\Annotation as Serializer;
Expand All @@ -22,7 +22,7 @@
*/
#[
Gedmo\Loggable(logEntryClass: \RZ\Roadiz\CoreBundle\Entity\UserLogEntry::class),
ORM\Entity(repositoryClass: \tests\mocks\GeneratedNodesSourcesWithRepository\Repository\NSMockRepository::class),
ORM\Entity(repositoryClass: \RZ\Roadiz\EntityGenerator\Tests\Mocks\GeneratedNodesSourcesWithRepository\Repository\NSMockRepository::class),
ORM\Table(name: "ns_mock"),
ORM\Index(columns: ["foo_datetime"]),
ORM\Index(columns: ["fooIndexed"]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* THIS IS A GENERATED FILE, DO NOT EDIT IT
* IT WILL BE RECREATED AT EACH NODE-TYPE UPDATE
*/
namespace tests\mocks\GeneratedNodesSourcesWithRepository\Repository;
namespace RZ\Roadiz\EntityGenerator\Tests\Mocks\GeneratedNodesSourcesWithRepository\Repository;

use Doctrine\Persistence\ManagerRegistry;
use RZ\Roadiz\CoreBundle\Preview\PreviewResolverInterface;
Expand All @@ -15,12 +15,12 @@
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;

/**
* @extends \RZ\Roadiz\CoreBundle\Repository\NodesSourcesRepository<\tests\mocks\GeneratedNodesSourcesWithRepository\NSMock>
* @extends \RZ\Roadiz\CoreBundle\Repository\NodesSourcesRepository<\RZ\Roadiz\EntityGenerator\Tests\Mocks\GeneratedNodesSourcesWithRepository\NSMock>
*
* @method \tests\mocks\GeneratedNodesSourcesWithRepository\NSMock|null find($id, $lockMode = null, $lockVersion = null)
* @method \tests\mocks\GeneratedNodesSourcesWithRepository\NSMock|null findOneBy(array $criteria, array $orderBy = null)
* @method \tests\mocks\GeneratedNodesSourcesWithRepository\NSMock[] findAll()
* @method \tests\mocks\GeneratedNodesSourcesWithRepository\NSMock[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
* @method \RZ\Roadiz\EntityGenerator\Tests\Mocks\GeneratedNodesSourcesWithRepository\NSMock|null find($id, $lockMode = null, $lockVersion = null)
* @method \RZ\Roadiz\EntityGenerator\Tests\Mocks\GeneratedNodesSourcesWithRepository\NSMock|null findOneBy(array $criteria, array $orderBy = null)
* @method \RZ\Roadiz\EntityGenerator\Tests\Mocks\GeneratedNodesSourcesWithRepository\NSMock[] findAll()
* @method \RZ\Roadiz\EntityGenerator\Tests\Mocks\GeneratedNodesSourcesWithRepository\NSMock[] findBy(array $criteria, array $orderBy = null, $limit = null, $offset = null)
*/
class NSMockRepository extends \RZ\Roadiz\CoreBundle\Repository\NodesSourcesRepository
{
Expand All @@ -33,6 +33,6 @@ public function __construct(
) {
parent::__construct($registry, $previewResolver, $dispatcher, $security, $nodeSourceSearchHandler);

$this->_entityName = \tests\mocks\GeneratedNodesSourcesWithRepository\NSMock::class;
$this->_entityName = \RZ\Roadiz\EntityGenerator\Tests\Mocks\GeneratedNodesSourcesWithRepository\NSMock::class;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace RZ\Roadiz\EntityGenerator\Test;
namespace RZ\Roadiz\EntityGenerator\Tests;

use Doctrine\Common\Collections\ArrayCollection;
use RZ\Roadiz\Contracts\NodeType\NodeTypeInterface;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace RZ\Roadiz\EntityGenerator\Test;
namespace RZ\Roadiz\EntityGenerator\Tests;

use RZ\Roadiz\Contracts\NodeType\NodeTypeFieldInterface;
use RZ\Roadiz\Contracts\NodeType\SerializableInterface;
Expand Down

0 comments on commit efa82ee

Please sign in to comment.