Skip to content

Commit

Permalink
[Tests] Configured importing FQCNs for Ibexa 5.0 rector set tests (#12)
Browse files Browse the repository at this point in the history
For more details see #12
  • Loading branch information
alongosz authored Sep 13, 2024
1 parent 8acd06a commit 2e48a1a
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 18 deletions.
5 changes: 3 additions & 2 deletions tests/lib/Sets/Ibexa50/Fixture/fieldtype_page_const.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,15 @@ class Foo {

namespace Ibexa\Rector\Tests\Sets\Ibexa50\Fixture;

use Ibexa\Bundle\FieldTypePage\DependencyInjection\IbexaFieldTypePageExtension;
use Ibexa\Bundle\FieldTypePage\DependencyInjection\Compiler\BlockDefinitionConfigurationCompilerPass;

class Foo {
public function foo(): array
{
return [
\Ibexa\Bundle\FieldTypePage\DependencyInjection\IbexaFieldTypePageExtension::EXTENSION_NAME,
\Ibexa\Bundle\FieldTypePage\DependencyInjection\IbexaFieldTypePageExtension::EXTENSION_NAME
IbexaFieldTypePageExtension::EXTENSION_NAME,
IbexaFieldTypePageExtension::EXTENSION_NAME
];
}

Expand Down
30 changes: 18 additions & 12 deletions tests/lib/Sets/Ibexa50/Fixture/rest_rename.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,26 @@

namespace Ibexa\Rector\Tests\Sets\Ibexa50\Fixture;

use Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider;
use Ibexa\Contracts\Core\Repository\Values\Content\Field;
use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType;
use Ibexa\Contracts\Rest\Output\Generator;
use Ibexa\Rest\Output\FieldTypeSerializer;

class Foo {
public function mediaTypeGenerator(): void
{
$generator = new \Ibexa\Contracts\Rest\Output\Generator();
$generator = new Generator();

return $generator->generateMediaType('name', 'type');
}

public function fieldTypeSerializer(): void
{
$serializer = new \Ibexa\Rest\Output\FieldTypeSerializer();
$serializer = new FieldTypeSerializer();

$generator = new \Ibexa\Contracts\Rest\Output\Generator();
$contentType = new \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType();
$field = new \Ibexa\Contracts\Core\Repository\Values\Content\Field();
$generator = new Generator();
$contentType = new ContentType();
$field = new Field();

return $serializer->serializeFieldValue($generator, $contentType, $field);
}
Expand All @@ -30,23 +33,26 @@ class Foo {

namespace Ibexa\Rector\Tests\Sets\Ibexa50\Fixture;

use Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider;
use Ibexa\Contracts\Core\Repository\Values\Content\Field;
use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType;
use Ibexa\Contracts\Rest\Output\Generator;
use Ibexa\Rest\Output\FieldTypeSerializer;

class Foo {
public function mediaTypeGenerator(): void
{
$generator = new \Ibexa\Contracts\Rest\Output\Generator();
$generator = new Generator();

return $generator->generateMediaTypeWithVendor('name', 'type');
}

public function fieldTypeSerializer(): void
{
$serializer = new \Ibexa\Rest\Output\FieldTypeSerializer();
$serializer = new FieldTypeSerializer();

$generator = new \Ibexa\Contracts\Rest\Output\Generator();
$contentType = new \Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType();
$field = new \Ibexa\Contracts\Core\Repository\Values\Content\Field();
$generator = new Generator();
$contentType = new ContentType();
$field = new Field();

return $serializer->serializeContentFieldValue($generator, $field);
}
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/Sets/Ibexa50/Fixture/some_class.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ class FooBar {

namespace Ibexa\Rector\Tests\Sets\Ibexa50\Fixture;

use Ibexa\Bundle\Core\ApiLoader\RepositoryConfigurationProvider;
use Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface;

class FooBar {
public function foo(): \Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface
public function foo(): RepositoryConfigurationProviderInterface
{
return $this->bar(\Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface::class);
return $this->bar(RepositoryConfigurationProviderInterface::class);
}

public function bar(string $class): \Ibexa\Contracts\Core\Container\ApiLoader\RepositoryConfigurationProviderInterface
public function bar(string $class): RepositoryConfigurationProviderInterface
{
return new $class();
}
Expand Down
1 change: 1 addition & 0 deletions tests/lib/Sets/Ibexa50/config/configured_rule.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->sets([IbexaSetList::IBEXA_50->value]);
$rectorConfig->importNames();
};

0 comments on commit 2e48a1a

Please sign in to comment.