Skip to content

Commit

Permalink
[TASK] Prepare release 4.0.1
Browse files Browse the repository at this point in the history
This bugfix release contains Fixes in:
* JavaScript registry
* Glossary functionality
* Glossary icon setup
  • Loading branch information
calien666 committed Jul 13, 2023
1 parent 3b573c0 commit b8dd42c
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 28 deletions.
30 changes: 30 additions & 0 deletions Build/phpstan/Core11/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,36 @@ parameters:
count: 1
path: ../../../Classes/Domain/Repository/GlossaryRepository.php

-
message: "#^Call to method getButtonBar\\(\\) on an unknown class TYPO3\\\\CMS\\\\Backend\\\\Template\\\\Components\\\\ModifyButtonBarEvent\\.$#"
count: 1
path: ../../../Classes/Event/Listener/GlossarySyncButtonProvider.php

-
message: "#^Call to method getButtons\\(\\) on an unknown class TYPO3\\\\CMS\\\\Backend\\\\Template\\\\Components\\\\ModifyButtonBarEvent\\.$#"
count: 1
path: ../../../Classes/Event/Listener/GlossarySyncButtonProvider.php

-
message: "#^Call to method getIdentifier\\(\\) on an unknown class TYPO3\\\\CMS\\\\Backend\\\\Module\\\\ModuleInterface\\.$#"
count: 2
path: ../../../Classes/Event/Listener/GlossarySyncButtonProvider.php

-
message: "#^Call to method setButtons\\(\\) on an unknown class TYPO3\\\\CMS\\\\Backend\\\\Template\\\\Components\\\\ModifyButtonBarEvent\\.$#"
count: 1
path: ../../../Classes/Event/Listener/GlossarySyncButtonProvider.php

-
message: "#^Cannot call method getRequestUri\\(\\) on TYPO3\\\\CMS\\\\Core\\\\Http\\\\NormalizedParams\\|null\\.$#"
count: 1
path: ../../../Classes/Event/Listener/GlossarySyncButtonProvider.php

-
message: "#^Parameter \\$event of method WebVision\\\\WvDeepltranslate\\\\Event\\\\Listener\\\\GlossarySyncButtonProvider\\:\\:__invoke\\(\\) has invalid type TYPO3\\\\CMS\\\\Backend\\\\Template\\\\Components\\\\ModifyButtonBarEvent\\.$#"
count: 1
path: ../../../Classes/Event/Listener/GlossarySyncButtonProvider.php

-
message: "#^Method WebVision\\\\WvDeepltranslate\\\\Form\\\\Item\\\\SiteConfigSupportedLanguageItemsProcFunc\\:\\:getSupportedLanguageForField\\(\\) has no return type specified\\.$#"
count: 1
Expand Down
5 changes: 5 additions & 0 deletions Build/phpstan/Core12/phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ parameters:
count: 1
path: ../../../Classes/Domain/Repository/PageTreeRepository.php

-
message: "#^Cannot call method getRequestUri\\(\\) on TYPO3\\\\CMS\\\\Core\\\\Http\\\\NormalizedParams\\|null\\.$#"
count: 1
path: ../../../Classes/Event/Listener/GlossarySyncButtonProvider.php

-
message: "#^Method WebVision\\\\WvDeepltranslate\\\\Form\\\\Item\\\\SiteConfigSupportedLanguageItemsProcFunc\\:\\:getSupportedLanguageForField\\(\\) has no return type specified\\.$#"
count: 1
Expand Down
1 change: 0 additions & 1 deletion Classes/Command/GlossaryListCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace WebVision\WvDeepltranslate\Command;

use DeepL\DeepLException;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputArgument;
Expand Down
1 change: 0 additions & 1 deletion Classes/Domain/Repository/GlossaryRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace WebVision\WvDeepltranslate\Domain\Repository;

use DeepL\DeepLException;
use DeepL\GlossaryInfo;
use Doctrine\DBAL\DBALException;
use Doctrine\DBAL\Driver\Exception;
Expand Down
10 changes: 9 additions & 1 deletion Classes/Event/Listener/GlossarySyncButtonProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace WebVision\WvDeepltranslate\Event\Listener;

use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\UriInterface;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Template\Components\ButtonBar;
use TYPO3\CMS\Backend\Template\Components\ModifyButtonBarEvent;
Expand Down Expand Up @@ -75,7 +76,7 @@ public function __invoke(ModifyButtonBarEvent $event): void
'glossaryupdate',
$parameters
);
$button->setHref($uri);
$button->setHref((string)$uri);

// Register Button and position it
$buttons[ButtonBar::BUTTON_POSITION_LEFT][5][] = $button;
Expand All @@ -97,6 +98,10 @@ protected function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}

/**
* @param array<int|string, mixed> $modTSconfig
*/
protected function isCreationAllowed(array $modTSconfig): bool
{
$allowedNewTables = GeneralUtility::trimExplode(',', $modTSconfig['allowedNewTables'] ?? '', true);
Expand All @@ -123,6 +128,9 @@ protected function canCreateNewRecord(int $id): bool
|| !$backendUser->workspaceCanCreateNewRecord(self::TABLE_NAME));
}

/**
* @return array{uid: int, returnUrl: string|UriInterface}
*/
private function buildParamsArrayForListView(int $id): array
{
return [
Expand Down
3 changes: 2 additions & 1 deletion Classes/Hooks/PageRendererHook.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

namespace WebVision\WvDeepltranslate\Hooks;

use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Information\Typo3Version;
use TYPO3\CMS\Core\Page\PageRenderer;

final class PageRendererHook
{
/**
Expand Down
3 changes: 0 additions & 3 deletions Classes/Service/DeeplGlossaryService.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public function createGlossary(
* Deletes a glossary
*
* @param string $glossaryId
*
*/
public function deleteGlossary(string $glossaryId): void
{
Expand All @@ -90,7 +89,6 @@ public function deleteGlossary(string $glossaryId): void

/**
* Gets information about a glossary
*
*/
public function glossaryInformation(string $glossaryId): ?GlossaryInfo
{
Expand All @@ -99,7 +97,6 @@ public function glossaryInformation(string $glossaryId): ?GlossaryInfo

/**
* Fetch glossary entries and format them as an associative array [source => target]
*
*/
public function glossaryEntries(string $glossaryId): ?GlossaryEntries
{
Expand Down
1 change: 0 additions & 1 deletion Classes/Service/DeeplService.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use DeepL\Language;
use DeepL\TextResult;
use Doctrine\DBAL\Driver\Exception;
use Psr\Log\LoggerInterface;
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\Messaging\FlashMessage;
Expand Down
2 changes: 1 addition & 1 deletion Configuration/Services.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
'event.listener',
[
'identifier' => 'glossary.syncbutton',
'event' => ModifyButtonBarEvent::class
'event' => ModifyButtonBarEvent::class,
]
);
}
Expand Down
37 changes: 18 additions & 19 deletions Tests/Functional/ClientTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace WebVision\WvDeepltranslate\Tests\Functional;

use DeepL\DeepLException;
use DeepL\GlossaryEntries;
use DeepL\GlossaryInfo;
use DeepL\GlossaryLanguagePair;
Expand Down Expand Up @@ -48,8 +47,8 @@ public function checkResponseFromTranslateContent(): void
'DE'
);

self::assertInstanceOf(TextResult::class, $response);
self::assertSame(self::EXAMPLE_TEXT['de'], $response->text);
static::assertInstanceOf(TextResult::class, $response);
static::assertSame(self::EXAMPLE_TEXT['de'], $response->text);
}

/**
Expand All @@ -60,8 +59,8 @@ public function checkResponseFromSupportedTargetLanguage(): void
$client = $this->makeClient();
$response = $client->getSupportedLanguageByType();

self::assertIsArray($response);
self::assertContainsOnlyInstancesOf(Language::class, $response);
static::assertIsArray($response);
static::assertContainsOnlyInstancesOf(Language::class, $response);
}

/**
Expand All @@ -72,8 +71,8 @@ public function checkResponseFromGlossaryLanguagePairs(): void
$client = $this->makeClient();
$response = $client->getGlossaryLanguagePairs();

self::assertIsArray($response);
self::assertContainsOnlyInstancesOf(GlossaryLanguagePair::class, $response);
static::assertIsArray($response);
static::assertContainsOnlyInstancesOf(GlossaryLanguagePair::class, $response);
}

/**
Expand All @@ -94,10 +93,10 @@ public function checkResponseFromCreateGlossary(): void
],
);

self::assertInstanceOf(GlossaryInfo::class, $response);
self::assertSame(1, $response->entryCount);
self::assertIsString($response->glossaryId);
self::assertInstanceOf(\DateTime::class, $response->creationTime);
static::assertInstanceOf(GlossaryInfo::class, $response);
static::assertSame(1, $response->entryCount);
static::assertIsString($response->glossaryId);
static::assertInstanceOf(\DateTime::class, $response->creationTime);
}

/**
Expand All @@ -108,8 +107,8 @@ public function checkResponseGetAllGlossaries(): void
$client = $this->makeClient();
$response = $client->getAllGlossaries();

self::assertIsArray($response);
self::assertContainsOnlyInstancesOf(GlossaryInfo::class, $response);
static::assertIsArray($response);
static::assertContainsOnlyInstancesOf(GlossaryInfo::class, $response);
}

/**
Expand All @@ -132,9 +131,9 @@ public function checkResponseFromGetGlossary(): void

$response = $client->getGlossary($glossary->glossaryId);

self::assertInstanceOf(GlossaryInfo::class, $response);
self::assertSame($glossary->glossaryId, $response->glossaryId);
self::assertSame(1, $response->entryCount);
static::assertInstanceOf(GlossaryInfo::class, $response);
static::assertSame($glossary->glossaryId, $response->glossaryId);
static::assertSame(1, $response->entryCount);
}

/**
Expand All @@ -159,7 +158,7 @@ public function checkGlossaryDeletedNotCatchable(): void

$client->deleteGlossary($glossaryId);

self::assertNull($client->getGlossary($glossaryId));
static::assertNull($client->getGlossary($glossaryId));
}

/**
Expand All @@ -182,7 +181,7 @@ public function checkResponseFromGetGlossaryEntries(): void

$response = $client->getGlossaryEntries($glossary->glossaryId);

self::assertInstanceOf(GlossaryEntries::class, $response);
self::assertSame(1, count($response->getEntries()));
static::assertInstanceOf(GlossaryEntries::class, $response);
static::assertSame(1, count($response->getEntries()));
}
}

0 comments on commit b8dd42c

Please sign in to comment.