Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IBX-8121: Fixed code style for 5.0 #160

Merged
merged 3 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ jobs:
- name: Setup PHP Action
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.3
coverage: none

- uses: ./.github/actions/composer-install
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"dama/doctrine-test-bundle": "^6.7.5",
"ibexa/admin-ui": "~5.0.x-dev",
"ibexa/ci-scripts": "^0.2@dev",
"ibexa/code-style": "^1.0",
"ibexa/code-style": "~2.0.0",
"ibexa/design-engine": "~5.0.x-dev",
"ibexa/doctrine-schema": "~5.0.x-dev",
"ibexa/notifications": "~5.0.x-dev",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function providerForTestProcessingCustomTagsConfiguration(): iterable
foreach ($finder as $file) {
$outputFilePath = self::OUTPUT_FIXTURES_DIR . $file->getFilename();
if (!file_exists($outputFilePath)) {
$this->markTestIncomplete("Missing output fixture: {$outputFilePath}");
self::markTestIncomplete("Missing output fixture: {$outputFilePath}");
}

$configs = [Yaml::parseFile($file->getPathname())];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function testRichTextConfiguration(): void
$this->load($config);

// Validate Custom Tags
$this->assertTrue(
self::assertTrue(
$this->container->hasParameter(IbexaFieldTypeRichTextExtension::RICHTEXT_CUSTOM_TAGS_PARAMETER)
);
$expectedCustomTagsConfig = [
Expand Down Expand Up @@ -84,7 +84,7 @@ public function testRichTextConfiguration(): void
],
];

$this->assertSame(
self::assertSame(
$expectedCustomTagsConfig,
$this->container->getParameter(IbexaFieldTypeRichTextExtension::RICHTEXT_CUSTOM_TAGS_PARAMETER)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function testExtractId(string $input, ?string $expected): void
{
$subject = new YoutubeIdExtractorExtension();
$result = $subject->extractId($input);
$this->assertEquals($expected, $result);
self::assertEquals($expected, $result);
}

/**
Expand All @@ -62,9 +62,9 @@ public function testGetFunctions(): void
$subject = new YoutubeIdExtractorExtension();
/** @var \Twig\TwigFunction[] $result */
$result = $subject->getFunctions();
$this->assertIsArray($result);
$this->assertInstanceOf(TwigFunction::class, $result[0]);
$this->assertEquals('ibexa_richtext_youtube_extract_id', $result[0]->getName());
self::assertIsArray($result);
self::assertInstanceOf(TwigFunction::class, $result[0]);
self::assertEquals('ibexa_richtext_youtube_extract_id', $result[0]->getName());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public function getFieldName()
*/
public function assertFieldDataLoadedCorrect(Field $field)
{
$this->assertInstanceOf(
self::assertInstanceOf(
RichTextValue::class,
$field->value
);
Expand Down Expand Up @@ -316,7 +316,7 @@ public function getValidUpdateFieldData()
*/
public function assertUpdatedFieldDataLoadedCorrect(Field $field)
{
$this->assertInstanceOf(
self::assertInstanceOf(
RichTextValue::class,
$field->value
);
Expand Down Expand Up @@ -365,7 +365,7 @@ public function provideInvalidUpdateFieldData()
*/
public function assertCopiedFieldDataLoadedCorrectly(Field $field)
{
$this->assertInstanceOf(
self::assertInstanceOf(
RichTextValue::class,
$field->value
);
Expand Down Expand Up @@ -458,13 +458,13 @@ public function testFromHash($hash, $expectedValue = null)
->getFieldTypeService()
->getFieldType($this->getTypeName())
->fromHash($hash);
$this->assertInstanceOf(
self::assertInstanceOf(
RichTextValue::class,
$richTextValue
);
$this->assertInstanceOf('DOMDocument', $richTextValue->xml);
self::assertInstanceOf('DOMDocument', $richTextValue->xml);

$this->assertEquals($hash['xml'], (string)$richTextValue);
self::assertEquals($hash['xml'], (string)$richTextValue);
}

public function providerForTestIsEmptyValue()
Expand Down Expand Up @@ -632,7 +632,7 @@ public function testConvertRemoteObjectIdToObjectId($test, $expected): void
[$locationService->newLocationCreateStruct($locationId)]
);

$this->assertEquals(
self::assertEquals(
str_replace('[ObjectId]', (string)$objectId, $expected),
$test->getField('description')->value->xml->saveXML()
);
Expand Down Expand Up @@ -1072,7 +1072,7 @@ private function getDocumentWithLocationLink(Location $location)
protected function checkSearchEngineSupport()
{
if ($this->getSetupFactory() instanceof SetupFactory\LegacySetupFactory) {
$this->markTestSkipped(
self::markTestSkipped(
"'ezrichtext' field type is not searchable with Legacy Search Engine"
);
}
Expand Down
6 changes: 3 additions & 3 deletions tests/lib/Configuration/Provider/AlloyEditorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,18 +50,18 @@ public function testGetConfiguration(): void
$provider = $this->createProvider();

$this->configResolver
->expects($this->any())
->expects(self::any())
->method('hasParameter')
->willReturn(false);

$this->mapper
->expects($this->once())
->expects(self::once())
->method('mapCssClassesConfiguration')
->with([])
->willReturn(['class1', 'class2']);

$this->mapper
->expects($this->once())
->expects(self::once())
->method('mapDataAttributesConfiguration')
->with([])
->willReturn(['attr1', 'attr2']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ final public function testGetConfiguration()
$tags = $this->getExpectedCustomTemplatesConfiguration();

$this->configResolver
->expects($this->once())
->expects(self::once())
->method('hasParameter')
->with($this->getCustomTemplateSiteAccessConfigParamName())
->willReturn(true);

$this->configResolver
->expects($this->once())
->expects(self::once())
->method('getParameter')
->with($this->getCustomTemplateSiteAccessConfigParamName())
->willReturn($tags);

$this->mapper
->expects($this->once())
->expects(self::once())
->method('mapConfig')
->with($tags)
->willReturnArgument(0);
Expand Down
8 changes: 4 additions & 4 deletions tests/lib/Configuration/UI/Config/Mapper/CustomTagTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private function getTranslatorInterfaceMock(): MockObject
{
$translatorInterfaceMock = $this->createMock(TranslatorInterface::class);
$translatorInterfaceMock
->expects($this->any())
->expects(self::any())
->method('trans')
->withAnyParameters()
->willReturnArgument(0);
Expand All @@ -194,14 +194,14 @@ private function getTranslatorBagInterfaceMock(): MockObject
{
$catalogueMock = $this->createMock(MessageCatalogueInterface::class);
$catalogueMock
->expects($this->any())
->expects(self::any())
->method('has')
->withAnyParameters()
->willReturn(false);

$translatorBagInterfaceMock = $this->createMock(TranslatorBagInterface::class);
$translatorBagInterfaceMock
->expects($this->any())
->expects(self::any())
->method('getCatalogue')
->willReturn(
$catalogueMock
Expand All @@ -217,7 +217,7 @@ private function getPackagesMock(): MockObject
{
$packagesMock = $this->createMock(Packages::class);
$packagesMock
->expects($this->any())
->expects(self::any())
->method('getUrl')
->withAnyParameters()
->willReturnArgument(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public function setUp(): void
/** @var \Symfony\Contracts\Translation\TranslatorInterface $translatorMock */
$translatorMock = $this->createMock(TranslatorInterface::class);
$translatorMock
->expects($this->any())
->expects(self::any())
->method('trans')
->willReturnArgument(0);
$this->mapper = new OnlineEditor($translatorMock, 'online_editor');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function testGetContentIds()

$gateway = $this->getStorageGateway();

$this->assertEquals(
self::assertEquals(
[
'f5c88a2209584891056f987fd965b0ba' => 4,
'faaeb9be3bd98ed09f606fc16d144eca' => 10,
Expand Down
56 changes: 28 additions & 28 deletions tests/lib/FieldType/RichText/RichTextStorageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,14 @@ public function testGetFieldData($xmlString, $updatedXmlString, $linkIds, $linkU
{
$gateway = $this->getGatewayMock();
$gateway
->expects($this->once())
->expects(self::once())
->method('getIdUrlMap')
->with($this->equalTo($linkIds))
->with(self::equalTo($linkIds))
->willReturn($linkUrls);

$gateway->expects($this->never())->method('getUrlIdMap');
$gateway->expects($this->never())->method('getContentIds');
$gateway->expects($this->never())->method('insertUrl');
$gateway->expects(self::never())->method('getUrlIdMap');
$gateway->expects(self::never())->method('getContentIds');
$gateway->expects(self::never())->method('insertUrl');

$logger = $this->getLoggerMock();
$missingIds = array_diff($linkIds, array_keys($linkUrls));
Expand All @@ -84,7 +84,7 @@ public function testGetFieldData($xmlString, $updatedXmlString, $linkIds, $linkU
}, $missingIds);

$logger
->expects($this->exactly(count($missingIds)))
->expects(self::exactly(count($missingIds)))
->method('error')
->withConsecutive($errorMessages);

Expand All @@ -99,7 +99,7 @@ public function testGetFieldData($xmlString, $updatedXmlString, $linkIds, $linkU
$this->getContext()
);

$this->assertEquals(
self::assertEquals(
$updatedXmlString,
$field->value->data
);
Expand Down Expand Up @@ -192,31 +192,31 @@ public function testStoreFieldData(
$gateway = $this->getGatewayMock();

$gateway
->expects($this->once())
->expects(self::once())
->method('getUrlIdMap')
->with($this->equalTo($linkUrls))
->with(self::equalTo($linkUrls))
->willReturn($linkIds);

$gateway
->expects($this->once())
->expects(self::once())
->method('getContentIds')
->with($this->equalTo($remoteIds))
->with(self::equalTo($remoteIds))
->willReturn($contentIds);

$gateway
->expects($this->never())
->expects(self::never())
->method('getIdUrlMap');

if (empty($insertLinks)) {
$gateway
->expects($this->never())
->expects(self::never())
->method('insertUrl');
}

[$urlAssertions, $insertedIds, $idsToLink] = $this->groupLinksData($linkUrls, $insertLinks, $linkIds);

$gateway
->expects($this->exactly(count($urlAssertions)))
->expects(self::exactly(count($urlAssertions)))
->method('insertUrl')
->withConsecutive($urlAssertions)
->willReturnOnConsecutiveCalls(...$insertedIds);
Expand All @@ -226,12 +226,12 @@ public function testStoreFieldData(
}, $idsToLink);

$gateway
->expects($this->exactly(count($idsToLink)))
->expects(self::exactly(count($idsToLink)))
->method('linkUrl')
->withConsecutive(...$linkUrlsArguments);

$gateway
->expects($this->once())
->expects(self::once())
->method('unlinkUrl')
->with(42, 24, $idsToLink);

Expand All @@ -242,11 +242,11 @@ public function testStoreFieldData(
$this->getContext()
);

$this->assertEquals(
self::assertEquals(
$isUpdated,
$result
);
$this->assertEquals(
self::assertEquals(
$updatedXmlString,
$field->value->data
);
Expand All @@ -266,7 +266,7 @@ private function groupLinksData(array $linkUrls, array $insertLinks, array $link
foreach ($linkUrls as $url) {
if (isset($insertLinks[$url])) {
$id = $insertLinks[$url];
$urlAssertions[] = $this->equalTo($url);
$urlAssertions[] = self::equalTo($url);
$insertedIds[] = $id;
$idsToLink[] = $id;
} else {
Expand Down Expand Up @@ -316,25 +316,25 @@ public function testStoreFieldDataThrowsNotFoundException(

$gateway = $this->getGatewayMock();
$gateway
->expects($this->once())
->expects(self::once())
->method('getUrlIdMap')
->with($this->equalTo($linkUrls))
->with(self::equalTo($linkUrls))
->willReturn($linkIds);
$gateway
->expects($this->once())
->expects(self::once())
->method('getContentIds')
->with($this->equalTo($remoteIds))
->with(self::equalTo($remoteIds))
->willReturn($contentIds);
$gateway->expects($this->never())->method('getIdUrlMap');
$gateway->expects(self::never())->method('getIdUrlMap');
if (empty($insertLinks)) {
$gateway->expects($this->never())->method('insertUrl');
$gateway->expects(self::never())->method('insertUrl');
}

foreach ($insertLinks as $index => $linkMap) {
$gateway
->expects($this->at($index + 2))
->expects(self::at($index + 2))
->method('insertUrl')
->with($this->equalTo($linkMap['url']))
->with(self::equalTo($linkMap['url']))
->willReturn($linkMap['id']);
}

Expand All @@ -357,7 +357,7 @@ public function testDeleteFieldData(): void
$gateway = $this->getGatewayMock();
$storage = $this->getPartlyMockedStorage($gateway);
$gateway
->expects($this->exactly(2))
->expects(self::exactly(2))
->method('unlinkUrl')
->withConsecutive(
[12, 42],
Expand Down
Loading
Loading