diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index e645f86ca9..073eaa9b24 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -930,26 +930,6 @@ parameters: count: 1 path: src/bundle/Core/DependencyInjection/Configuration/Parser/AbstractFieldTypeParser.php - - - message: "#^Cannot access offset 'name' on array\\|bool\\|float\\|int\\|string\\|null\\.$#" - count: 1 - path: src/bundle/Core/DependencyInjection/Configuration/Parser/Common.php - - - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\Common\\:\\:addDatabaseConfigSuggestion\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Core/DependencyInjection/Configuration/Parser/Common.php - - - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\Common\\:\\:addDatabaseConfigSuggestion\\(\\) has parameter \\$databaseConfig with no value type specified in iterable type array\\.$#" - count: 1 - path: src/bundle/Core/DependencyInjection/Configuration/Parser/Common.php - - - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\Common\\:\\:addDatabaseConfigSuggestion\\(\\) has parameter \\$sa with no type specified\\.$#" - count: 1 - path: src/bundle/Core/DependencyInjection/Configuration/Parser/Common.php - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\Common\\:\\:addSemanticConfig\\(\\) has no return type specified\\.$#" count: 1 @@ -970,11 +950,6 @@ parameters: count: 1 path: src/bundle/Core/DependencyInjection/Configuration/Parser/Common.php - - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\Common\\:\\:setSuggestionCollector\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Core/DependencyInjection/Configuration/Parser/Common.php - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\Content\\:\\:addSemanticConfig\\(\\) has no return type specified\\.$#" count: 1 @@ -1065,11 +1040,6 @@ parameters: count: 1 path: src/bundle/Core/DependencyInjection/Configuration/Parser/Image.php - - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\Image\\:\\:setSuggestionCollector\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Core/DependencyInjection/Configuration/Parser/Image.php - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\Languages\\:\\:addSemanticConfig\\(\\) has no return type specified\\.$#" count: 1 @@ -1805,16 +1775,6 @@ parameters: count: 1 path: src/bundle/Core/DependencyInjection/IbexaCoreExtension.php - - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\DependencyInjection\\\\IbexaCoreExtension\\:\\:registerImageMagickConfiguration\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Core/DependencyInjection/IbexaCoreExtension.php - - - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\DependencyInjection\\\\IbexaCoreExtension\\:\\:registerImageMagickConfiguration\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#" - count: 1 - path: src/bundle/Core/DependencyInjection/IbexaCoreExtension.php - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\DependencyInjection\\\\IbexaCoreExtension\\:\\:registerOrmConfiguration\\(\\) has parameter \\$config with no value type specified in iterable type array\\.$#" count: 1 @@ -1925,11 +1885,6 @@ parameters: count: 1 path: src/bundle/Core/DependencyInjection/Security/PolicyProvider/PolicyProviderInterface.php - - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\DependencyInjection\\\\Security\\\\PolicyProvider\\\\RepositoryPolicyProvider\\:\\:getFiles\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/bundle/Core/DependencyInjection/Security/PolicyProvider/RepositoryPolicyProvider.php - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\DependencyInjection\\\\Security\\\\PolicyProvider\\\\YamlPolicyProvider\\:\\:addPolicies\\(\\) has no return type specified\\.$#" count: 1 @@ -3795,16 +3750,6 @@ parameters: count: 1 path: src/bundle/Core/Routing/DefaultRouter.php - - - message: "#^Parameter \\#1 \\$httpPort of method Symfony\\\\Component\\\\Routing\\\\RequestContext\\:\\:setHttpPort\\(\\) expects int, string given\\.$#" - count: 1 - path: src/bundle/Core/Routing/DefaultRouter.php - - - - message: "#^Parameter \\#1 \\$httpsPort of method Symfony\\\\Component\\\\Routing\\\\RequestContext\\:\\:setHttpsPort\\(\\) expects int, string given\\.$#" - count: 1 - path: src/bundle/Core/Routing/DefaultRouter.php - - message: "#^Property Ibexa\\\\Bundle\\\\Core\\\\Routing\\\\DefaultRouter\\:\\:\\$nonSiteAccessAwareRoutes has no type specified\\.$#" count: 1 @@ -4000,11 +3945,6 @@ parameters: count: 1 path: src/bundle/Core/Variation/VariationHandlerResolver.php - - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\View\\\\Manager\\:\\:setSiteAccess\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/Core/View/Manager.php - - message: "#^Method Ibexa\\\\Bundle\\\\Core\\\\View\\\\Provider\\\\Configured\\:\\:setSiteAccess\\(\\) has no return type specified\\.$#" count: 1 @@ -4755,11 +4695,6 @@ parameters: count: 1 path: src/bundle/RepositoryInstaller/IbexaRepositoryInstallerBundle.php - - - message: "#^Method Ibexa\\\\Bundle\\\\RepositoryInstaller\\\\Installer\\\\CoreInstaller\\:\\:createConfiguration\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/RepositoryInstaller/Installer/CoreInstaller.php - - message: "#^Method Ibexa\\\\Bundle\\\\RepositoryInstaller\\\\Installer\\\\CoreInstaller\\:\\:importBinaries\\(\\) has no return type specified\\.$#" count: 1 @@ -4810,11 +4745,6 @@ parameters: count: 1 path: src/bundle/RepositoryInstaller/Installer/DbBasedInstaller.php - - - message: "#^Method Ibexa\\\\Bundle\\\\RepositoryInstaller\\\\Installer\\\\Installer\\:\\:createConfiguration\\(\\) has no return type specified\\.$#" - count: 1 - path: src/bundle/RepositoryInstaller/Installer/Installer.php - - message: "#^Method Ibexa\\\\Bundle\\\\RepositoryInstaller\\\\Installer\\\\Installer\\:\\:importBinaries\\(\\) has no return type specified\\.$#" count: 1 @@ -4880,11 +4810,6 @@ parameters: count: 1 path: src/contracts/Container/Encore/ConfigurationDumper.php - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\FieldType\\\\BinaryBase\\\\PathGenerator\\:\\:getStoragePathForField\\(\\) has no return type specified\\.$#" - count: 1 - path: src/contracts/FieldType/BinaryBase/PathGenerator.php - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\FieldType\\\\BinaryBase\\\\PathGeneratorInterface\\:\\:getStoragePathForField\\(\\) has no return type specified\\.$#" count: 1 @@ -4900,11 +4825,6 @@ parameters: count: 1 path: src/contracts/FieldType/BinaryBase/RouteAwarePathGenerator.php - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\FieldType\\\\FieldStorage\\:\\:deleteFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/contracts/FieldType/FieldStorage.php - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\FieldType\\\\FieldStorage\\:\\:deleteFieldData\\(\\) has parameter \\$fieldIds with no value type specified in iterable type array\\.$#" count: 1 @@ -4915,21 +4835,6 @@ parameters: count: 1 path: src/contracts/FieldType/FieldStorage.php - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\FieldType\\\\FieldStorage\\:\\:getFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/contracts/FieldType/FieldStorage.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\FieldType\\\\FieldStorage\\:\\:getIndexData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/contracts/FieldType/FieldStorage.php - - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\FieldType\\\\FieldStorage\\:\\:storeFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/contracts/FieldType/FieldStorage.php - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\FieldType\\\\FieldType\\:\\:applyDefaultSettings\\(\\) has no return type specified\\.$#" count: 1 @@ -4965,11 +4870,6 @@ parameters: count: 1 path: src/contracts/FieldType/FieldType.php - - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\FieldType\\\\GatewayBasedStorage\\:\\:copyLegacyField\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/contracts/FieldType/GatewayBasedStorage.php - - message: "#^Method Ibexa\\\\Contracts\\\\Core\\\\FieldType\\\\Generic\\\\Type\\:\\:fieldSettingsFromHash\\(\\) has parameter \\$fieldSettingsHash with no value type specified in iterable type array\\.$#" count: 1 @@ -7755,11 +7655,6 @@ parameters: count: 1 path: src/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPass.php - - - message: "#^Parameter \\#1 \\$object_or_class of function is_subclass_of expects object\\|string, array\\|bool\\|float\\|int\\|string\\|null given\\.$#" - count: 1 - path: src/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPass.php - - message: "#^Method Ibexa\\\\Core\\\\Base\\\\Container\\\\Compiler\\\\Storage\\\\Legacy\\\\RoleLimitationConverterPass\\:\\:process\\(\\) has no return type specified\\.$#" count: 1 @@ -8620,16 +8515,6 @@ parameters: count: 1 path: src/lib/FieldType/BinaryBase/BinaryBaseStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\BinaryBase\\\\BinaryBaseStorage\\:\\:copyLegacyField\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/BinaryBase/BinaryBaseStorage.php - - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\BinaryBase\\\\BinaryBaseStorage\\:\\:deleteFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/BinaryBase/BinaryBaseStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\BinaryBase\\\\BinaryBaseStorage\\:\\:deleteFieldData\\(\\) has parameter \\$fieldIds with no value type specified in iterable type array\\.$#" count: 1 @@ -8650,36 +8535,16 @@ parameters: count: 1 path: src/lib/FieldType/BinaryBase/BinaryBaseStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\BinaryBase\\\\BinaryBaseStorage\\:\\:getFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/BinaryBase/BinaryBaseStorage.php - - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\BinaryBase\\\\BinaryBaseStorage\\:\\:getIndexData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/BinaryBase/BinaryBaseStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\BinaryBase\\\\BinaryBaseStorage\\:\\:removeOldFile\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/FieldType/BinaryBase/BinaryBaseStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\BinaryBase\\\\BinaryBaseStorage\\:\\:removeOldFile\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/BinaryBase/BinaryBaseStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\BinaryBase\\\\BinaryBaseStorage\\:\\:setDownloadUrlGenerator\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/FieldType/BinaryBase/BinaryBaseStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\BinaryBase\\\\BinaryBaseStorage\\:\\:storeFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/BinaryBase/BinaryBaseStorage.php - - message: "#^Parameter \\#2 \\$versionNo of method Ibexa\\\\Core\\\\FieldType\\\\BinaryBase\\\\BinaryBaseStorage\\:\\:removeOldFile\\(\\) expects string, int given\\.$#" count: 1 @@ -8695,11 +8560,6 @@ parameters: count: 1 path: src/lib/FieldType/BinaryBase/BinaryBaseStorage.php - - - message: "#^Property Ibexa\\\\Core\\\\FieldType\\\\BinaryBase\\\\BinaryBaseStorage\\:\\:\\$downloadUrlGenerator \\(Ibexa\\\\Contracts\\\\Core\\\\FieldType\\\\BinaryBase\\\\PathGenerator\\) in isset\\(\\) is not nullable\\.$#" - count: 2 - path: src/lib/FieldType/BinaryBase/BinaryBaseStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\BinaryBase\\\\BinaryBaseStorage\\\\Gateway\\:\\:countFileReferences\\(\\) has parameter \\$files with no value type specified in iterable type array\\.$#" count: 1 @@ -9125,21 +8985,6 @@ parameters: count: 1 path: src/lib/FieldType/FieldType.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\GatewayBasedStorage\\:\\:addGateway\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/FieldType/GatewayBasedStorage.php - - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\GatewayBasedStorage\\:\\:copyLegacyField\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/GatewayBasedStorage.php - - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\GatewayBasedStorage\\:\\:getGateway\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/GatewayBasedStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Handler\\:\\:initWithFieldTypeValue\\(\\) has no return type specified\\.$#" count: 1 @@ -9265,11 +9110,6 @@ parameters: count: 1 path: src/lib/FieldType/Image/ImageStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Image\\\\ImageStorage\\:\\:deleteFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/Image/ImageStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Image\\\\ImageStorage\\:\\:deleteFieldData\\(\\) has parameter \\$fieldIds with no value type specified in iterable type array\\.$#" count: 1 @@ -9285,21 +9125,6 @@ parameters: count: 1 path: src/lib/FieldType/Image/ImageStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Image\\\\ImageStorage\\:\\:getFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/Image/ImageStorage.php - - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Image\\\\ImageStorage\\:\\:getIndexData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/Image/ImageStorage.php - - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Image\\\\ImageStorage\\:\\:storeFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/Image/ImageStorage.php - - message: "#^Parameter \\#1 \\.\\.\\.\\$arrays of function array_merge expects array, array\\|bool\\|float\\|int\\|string given\\.$#" count: 1 @@ -9510,11 +9335,6 @@ parameters: count: 1 path: src/lib/FieldType/Keyword/KeywordStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Keyword\\\\KeywordStorage\\:\\:deleteFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/Keyword/KeywordStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Keyword\\\\KeywordStorage\\:\\:deleteFieldData\\(\\) has parameter \\$fieldIds with no value type specified in iterable type array\\.$#" count: 1 @@ -9525,21 +9345,6 @@ parameters: count: 1 path: src/lib/FieldType/Keyword/KeywordStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Keyword\\\\KeywordStorage\\:\\:getFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/Keyword/KeywordStorage.php - - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Keyword\\\\KeywordStorage\\:\\:getIndexData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/Keyword/KeywordStorage.php - - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Keyword\\\\KeywordStorage\\:\\:storeFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/Keyword/KeywordStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Keyword\\\\KeywordStorage\\\\Gateway\\:\\:deleteFieldData\\(\\) has no return type specified\\.$#" count: 1 @@ -9660,11 +9465,6 @@ parameters: count: 1 path: src/lib/FieldType/MapLocation/MapLocationStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\MapLocation\\\\MapLocationStorage\\:\\:deleteFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/MapLocation/MapLocationStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\MapLocation\\\\MapLocationStorage\\:\\:deleteFieldData\\(\\) has parameter \\$fieldIds with no value type specified in iterable type array\\.$#" count: 1 @@ -9680,21 +9480,6 @@ parameters: count: 1 path: src/lib/FieldType/MapLocation/MapLocationStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\MapLocation\\\\MapLocationStorage\\:\\:getFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/MapLocation/MapLocationStorage.php - - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\MapLocation\\\\MapLocationStorage\\:\\:getIndexData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/MapLocation/MapLocationStorage.php - - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\MapLocation\\\\MapLocationStorage\\:\\:storeFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/MapLocation/MapLocationStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\MapLocation\\\\MapLocationStorage\\\\Gateway\\:\\:deleteFieldData\\(\\) has no return type specified\\.$#" count: 1 @@ -9870,21 +9655,11 @@ parameters: count: 1 path: src/lib/FieldType/Null/Type.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\NullStorage\\:\\:copyLegacyField\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/NullStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\NullStorage\\:\\:copyLegacyField\\(\\) should return bool\\|null but empty return statement found\\.$#" count: 1 path: src/lib/FieldType/NullStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\NullStorage\\:\\:deleteFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/NullStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\NullStorage\\:\\:deleteFieldData\\(\\) has parameter \\$fieldIds with no value type specified in iterable type array\\.$#" count: 1 @@ -9895,21 +9670,6 @@ parameters: count: 1 path: src/lib/FieldType/NullStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\NullStorage\\:\\:getFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/NullStorage.php - - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\NullStorage\\:\\:getIndexData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/NullStorage.php - - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\NullStorage\\:\\:storeFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/NullStorage.php - - message: "#^Parameter \\#1 \\$array of function reset expects array\\|object, array\\|bool\\|float\\|int\\|string\\|null given\\.$#" count: 1 @@ -10075,11 +9835,6 @@ parameters: count: 1 path: src/lib/FieldType/Url/UrlStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Url\\\\UrlStorage\\:\\:deleteFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/Url/UrlStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Url\\\\UrlStorage\\:\\:deleteFieldData\\(\\) has parameter \\$fieldIds with no value type specified in iterable type array\\.$#" count: 1 @@ -10095,21 +9850,6 @@ parameters: count: 1 path: src/lib/FieldType/Url/UrlStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Url\\\\UrlStorage\\:\\:getFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/Url/UrlStorage.php - - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Url\\\\UrlStorage\\:\\:getIndexData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/Url/UrlStorage.php - - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\Url\\\\UrlStorage\\:\\:storeFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/Url/UrlStorage.php - - message: "#^Property Ibexa\\\\Core\\\\FieldType\\\\Url\\\\UrlStorage\\:\\:\\$logger \\(Psr\\\\Log\\\\LoggerInterface\\) does not accept Psr\\\\Log\\\\LoggerInterface\\|null\\.$#" count: 1 @@ -10245,31 +9985,11 @@ parameters: count: 1 path: src/lib/FieldType/User/UserStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\User\\\\UserStorage\\:\\:deleteFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/User/UserStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\User\\\\UserStorage\\:\\:getFieldData\\(\\) has no return type specified\\.$#" count: 1 path: src/lib/FieldType/User/UserStorage.php - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\User\\\\UserStorage\\:\\:getFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/User/UserStorage.php - - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\User\\\\UserStorage\\:\\:getIndexData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/User/UserStorage.php - - - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\User\\\\UserStorage\\:\\:storeFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/FieldType/User/UserStorage.php - - message: "#^Method Ibexa\\\\Core\\\\FieldType\\\\User\\\\UserStorage\\\\Gateway\\:\\:getFieldData\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -10860,31 +10580,6 @@ parameters: count: 1 path: src/lib/IO/IOServiceInterface.php - - - message: "#^Method Ibexa\\\\Core\\\\IO\\\\MetadataHandler\\:\\:extract\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/IO/MetadataHandler.php - - - - message: "#^Cannot access offset 'mime' on array\\{0\\: int\\<0, max\\>, 1\\: int\\<0, max\\>, 2\\: int, 3\\: string, mime\\: string, channels\\?\\: int, bits\\?\\: int\\}\\|false\\.$#" - count: 1 - path: src/lib/IO/MetadataHandler/ImageSize.php - - - - message: "#^Cannot access offset 0 on array\\{0\\: int\\<0, max\\>, 1\\: int\\<0, max\\>, 2\\: int, 3\\: string, mime\\: string, channels\\?\\: int, bits\\?\\: int\\}\\|false\\.$#" - count: 1 - path: src/lib/IO/MetadataHandler/ImageSize.php - - - - message: "#^Cannot access offset 1 on array\\{0\\: int\\<0, max\\>, 1\\: int\\<0, max\\>, 2\\: int, 3\\: string, mime\\: string, channels\\?\\: int, bits\\?\\: int\\}\\|false\\.$#" - count: 1 - path: src/lib/IO/MetadataHandler/ImageSize.php - - - - message: "#^Method Ibexa\\\\Core\\\\IO\\\\MetadataHandler\\\\ImageSize\\:\\:extract\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/IO/MetadataHandler/ImageSize.php - - message: "#^Property Ibexa\\\\Core\\\\IO\\\\MimeTypeDetector\\\\FileInfo\\:\\:\\$fileInfo \\(finfo\\) in isset\\(\\) is not nullable\\.$#" count: 1 @@ -11355,16 +11050,6 @@ parameters: count: 1 path: src/lib/MVC/Symfony/Event/APIContentExceptionEvent.php - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Event\\\\ContentCacheClearEvent\\:\\:addLocationToClear\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Event/ContentCacheClearEvent.php - - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Event\\\\ContentCacheClearEvent\\:\\:setLocationsToClear\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Event/ContentCacheClearEvent.php - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Event\\\\PostSiteAccessMatchEvent\\:\\:__construct\\(\\) has parameter \\$requestType with no type specified\\.$#" count: 1 @@ -11485,11 +11170,6 @@ parameters: count: 1 path: src/lib/MVC/Symfony/Locale/LocaleConverter.php - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Locale\\\\LocaleConverter\\:\\:convertToEz\\(\\) should return string\\|null but empty return statement found\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Locale/LocaleConverter.php - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Locale\\\\LocaleConverter\\:\\:convertToPOSIX\\(\\) should return string\\|null but empty return statement found\\.$#" count: 1 @@ -11690,16 +11370,6 @@ parameters: count: 1 path: src/lib/MVC/Symfony/Routing/Generator.php - - - message: "#^Parameter \\#1 \\$httpPort of method Symfony\\\\Component\\\\Routing\\\\RequestContext\\:\\:setHttpPort\\(\\) expects int, string given\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Routing/Generator.php - - - - message: "#^Parameter \\#1 \\$httpsPort of method Symfony\\\\Component\\\\Routing\\\\RequestContext\\:\\:setHttpsPort\\(\\) expects int, string given\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Routing/Generator.php - - message: "#^Property Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Routing\\\\Generator\\:\\:\\$logger \\(Psr\\\\Log\\\\LoggerInterface\\) does not accept Psr\\\\Log\\\\LoggerInterface\\|null\\.$#" count: 1 @@ -11890,21 +11560,6 @@ parameters: count: 1 path: src/lib/MVC/Symfony/Routing/SimplifiedRequest.php - - - message: "#^Property Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Routing\\\\SimplifiedRequest\\:\\:\\$headers type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Routing/SimplifiedRequest.php - - - - message: "#^Property Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Routing\\\\SimplifiedRequest\\:\\:\\$languages type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Routing/SimplifiedRequest.php - - - - message: "#^Property Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\Routing\\\\SimplifiedRequest\\:\\:\\$queryParams type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/MVC/Symfony/Routing/SimplifiedRequest.php - - message: "#^Unsafe usage of new static\\(\\)\\.$#" count: 1 @@ -12260,11 +11915,6 @@ parameters: count: 1 path: src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Port.php - - - message: "#^Parameter \\#1 \\$key of method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\Matcher\\\\Map\\:\\:setMapKey\\(\\) expects string, int\\|string given\\.$#" - count: 1 - path: src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Port.php - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\Matcher\\\\Map\\\\URI\\:\\:setRequest\\(\\) has no return type specified\\.$#" count: 1 @@ -12300,46 +11950,6 @@ parameters: count: 1 path: src/lib/MVC/Symfony/SiteAccess/Matcher/Regex.php - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\Matcher\\\\Regex\\\\Host\\:\\:__construct\\(\\) has parameter \\$siteAccessesConfiguration with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/Host.php - - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\Matcher\\\\Regex\\\\Host\\:\\:setRequest\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/Host.php - - - - message: "#^Property Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\Matcher\\\\Regex\\\\Host\\:\\:\\$siteAccessesConfiguration is never read, only written\\.$#" - count: 1 - path: src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/Host.php - - - - message: "#^Property Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\Matcher\\\\Regex\\\\Host\\:\\:\\$siteAccessesConfiguration type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/Host.php - - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\Matcher\\\\Regex\\\\URI\\:\\:__construct\\(\\) has parameter \\$siteAccessesConfiguration with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/URI.php - - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\Matcher\\\\Regex\\\\URI\\:\\:setRequest\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/URI.php - - - - message: "#^Property Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\Matcher\\\\Regex\\\\URI\\:\\:\\$siteAccessesConfiguration is never read, only written\\.$#" - count: 1 - path: src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/URI.php - - - - message: "#^Property Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\Matcher\\\\Regex\\\\URI\\:\\:\\$siteAccessesConfiguration type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/URI.php - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\Matcher\\\\URIElement\\:\\:__construct\\(\\) has parameter \\$elementNumber with no value type specified in iterable type array\\.$#" count: 1 @@ -13380,36 +12990,6 @@ parameters: count: 1 path: src/lib/MVC/Symfony/View/Manager.php - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\Manager\\:\\:addContentViewProvider\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/MVC/Symfony/View/Manager.php - - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\Manager\\:\\:addLocationViewProvider\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/MVC/Symfony/View/Manager.php - - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\Manager\\:\\:addViewProvider\\(\\) has no return type specified\\.$#" - count: 1 - path: src/lib/MVC/Symfony/View/Manager.php - - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\Manager\\:\\:addViewProvider\\(\\) has parameter \\$property with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/MVC/Symfony/View/Manager.php - - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\Manager\\:\\:getAllContentViewProviders\\(\\) should return array\\ but returns array\\\\.$#" - count: 1 - path: src/lib/MVC/Symfony/View/Manager.php - - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\Manager\\:\\:getAllLocationViewProviders\\(\\) should return array\\ but returns array\\\\.$#" - count: 1 - path: src/lib/MVC/Symfony/View/Manager.php - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\Manager\\:\\:renderContent\\(\\) has parameter \\$parameters with no value type specified in iterable type array\\.$#" count: 1 @@ -13425,36 +13005,11 @@ parameters: count: 1 path: src/lib/MVC/Symfony/View/Manager.php - - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\Manager\\:\\:sortViewProviders\\(\\) has parameter \\$property with no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/MVC/Symfony/View/Manager.php - - - - message: "#^Property Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\Manager\\:\\:\\$contentViewProviders type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/MVC/Symfony/View/Manager.php - - - - message: "#^Property Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\Manager\\:\\:\\$locationViewProviders type has no value type specified in iterable type array\\.$#" - count: 1 - path: src/lib/MVC/Symfony/View/Manager.php - - message: "#^Property Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\Manager\\:\\:\\$logger \\(Psr\\\\Log\\\\LoggerInterface\\) does not accept Psr\\\\Log\\\\LoggerInterface\\|null\\.$#" count: 1 path: src/lib/MVC/Symfony/View/Manager.php - - - message: "#^Property Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\Manager\\:\\:\\$sortedContentViewProviders \\(array\\\\) does not accept array\\\\.$#" - count: 1 - path: src/lib/MVC/Symfony/View/Manager.php - - - - message: "#^Property Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\Manager\\:\\:\\$sortedLocationViewProviders \\(array\\\\) does not accept array\\\\.$#" - count: 1 - path: src/lib/MVC/Symfony/View/Manager.php - - message: "#^Method Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\ParametersInjector\\:\\:injectViewParameters\\(\\) has no return type specified\\.$#" count: 1 @@ -18670,11 +18225,6 @@ parameters: count: 1 path: src/lib/Persistence/Legacy/User/Mapper.php - - - message: "#^array\\|string does not accept array\\\\.$#" - count: 1 - path: src/lib/Persistence/Legacy/User/Mapper.php - - message: "#^Method Ibexa\\\\Core\\\\Persistence\\\\Legacy\\\\User\\\\Role\\\\Gateway\\:\\:addPolicyLimitations\\(\\) has parameter \\$limitations with no value type specified in iterable type array\\.$#" count: 1 @@ -20745,21 +20295,6 @@ parameters: count: 1 path: src/lib/Repository/URLWildcardService.php - - - message: "#^Result of \\|\\| is always false\\.$#" - count: 1 - path: src/lib/Repository/URLWildcardService.php - - - - message: "#^Variable \\$patterns in empty\\(\\) always exists and is not falsy\\.$#" - count: 1 - path: src/lib/Repository/URLWildcardService.php - - - - message: "#^Variable \\$placeholders in empty\\(\\) always exists and is not falsy\\.$#" - count: 1 - path: src/lib/Repository/URLWildcardService.php - - message: "#^Parameter \\#3 \\$hashType of method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\PasswordHashService\\:\\:isValidPassword\\(\\) expects int\\|null, string given\\.$#" count: 1 @@ -23215,16 +22750,6 @@ parameters: count: 1 path: tests/bundle/Core/DependencyInjection/Configuration/Parser/CommonTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\CommonTest\\:\\:testDatabaseSingleSiteaccess\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/Core/DependencyInjection/Configuration/Parser/CommonTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\CommonTest\\:\\:testDatabaseSiteaccessGroup\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/bundle/Core/DependencyInjection/Configuration/Parser/CommonTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\CommonTest\\:\\:testDefaultPage\\(\\) has no return type specified\\.$#" count: 1 @@ -23285,11 +22810,6 @@ parameters: count: 1 path: tests/bundle/Core/DependencyInjection/Configuration/Parser/CommonTest.php - - - message: "#^Property Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\CommonTest\\:\\:\\$suggestionCollector is never read, only written\\.$#" - count: 1 - path: tests/bundle/Core/DependencyInjection/Configuration/Parser/CommonTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Bundle\\\\Core\\\\DependencyInjection\\\\Configuration\\\\Parser\\\\ContentTest\\:\\:contentSettingsProvider\\(\\) has no return type specified\\.$#" count: 1 @@ -25945,21 +25465,6 @@ parameters: count: 1 path: tests/integration/Core/IO/BinarydataHandler/FlysystemTest.php - - - message: "#^Generator expects value type array\\{Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Image\\\\ImageStorage\\\\Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\VersionInfo, Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Image\\\\ImageStorage\\\\Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\Field\\}, array\\{Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\VersionInfo, Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\Field\\} given\\.$#" - count: 1 - path: tests/integration/Core/Image/ImageStorage/ImageStorageTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Image\\\\ImageStorage\\\\ImageStorageTest\\:\\:providerOfFieldData\\(\\) has invalid return type Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Image\\\\ImageStorage\\\\Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\Field\\.$#" - count: 1 - path: tests/integration/Core/Image/ImageStorage/ImageStorageTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Image\\\\ImageStorage\\\\ImageStorageTest\\:\\:providerOfFieldData\\(\\) has invalid return type Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Image\\\\ImageStorage\\\\Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\VersionInfo\\.$#" - count: 1 - path: tests/integration/Core/Image/ImageStorage/ImageStorageTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Limitation\\\\MemberOfLimitationTest\\:\\:testCanUserAssignRoleToUser\\(\\) has parameter \\$limitations with no value type specified in iterable type array\\.$#" count: 1 @@ -26570,11 +26075,6 @@ parameters: count: 2 path: tests/integration/Core/Repository/ContentServiceAuthorizationTest.php - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, iterable\\ given\\.$#" - count: 4 - path: tests/integration/Core/Repository/ContentServiceAuthorizationTest.php - - message: "#^Access to an undefined property object\\:\\:\\$content\\.$#" count: 6 @@ -26675,11 +26175,6 @@ parameters: count: 1 path: tests/integration/Core/Repository/ContentServiceTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\ContentServiceTest\\:\\:testAddRelation\\(\\) should return array\\ but returns iterable\\\\.$#" - count: 1 - path: tests/integration/Core/Repository/ContentServiceTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\ContentServiceTest\\:\\:testAddRelationAddsRelationToContent\\(\\) has no return type specified\\.$#" count: 1 @@ -26790,11 +26285,6 @@ parameters: count: 1 path: tests/integration/Core/Repository/ContentServiceTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\ContentServiceTest\\:\\:testCreateContentDraftWithRelations\\(\\) should return array\\ but returns iterable\\\\.$#" - count: 1 - path: tests/integration/Core/Repository/ContentServiceTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\ContentServiceTest\\:\\:testCreateContentDraftWithRelationsCreatesExpectedRelations\\(\\) has no return type specified\\.$#" count: 1 @@ -27035,11 +26525,6 @@ parameters: count: 1 path: tests/integration/Core/Repository/ContentServiceTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\ContentServiceTest\\:\\:testLoadAllContentDrafts\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/integration/Core/Repository/ContentServiceTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\ContentServiceTest\\:\\:testLoadContent\\(\\) has no return type specified\\.$#" count: 1 @@ -27105,21 +26590,6 @@ parameters: count: 1 path: tests/integration/Core/Repository/ContentServiceTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\ContentServiceTest\\:\\:testLoadContentDraftListWithForUserWithLimitation\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/integration/Core/Repository/ContentServiceTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\ContentServiceTest\\:\\:testLoadContentDraftListWithPaginationParameters\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/integration/Core/Repository/ContentServiceTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\ContentServiceTest\\:\\:testLoadContentDrafts\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/integration/Core/Repository/ContentServiceTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\ContentServiceTest\\:\\:testLoadContentDraftsReturnsEmptyArrayByDefault\\(\\) has no return type specified\\.$#" count: 1 @@ -27205,11 +26675,6 @@ parameters: count: 1 path: tests/integration/Core/Repository/ContentServiceTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\ContentServiceTest\\:\\:testLoadRelations\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/integration/Core/Repository/ContentServiceTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\ContentServiceTest\\:\\:testLoadRelationsSkipsArchivedContent\\(\\) has no return type specified\\.$#" count: 1 @@ -27520,11 +26985,6 @@ parameters: count: 1 path: tests/integration/Core/Repository/ContentServiceTest.php - - - message: "#^Parameter \\#1 \\$array of function array_values expects array\\, iterable\\ given\\.$#" - count: 1 - path: tests/integration/Core/Repository/ContentServiceTest.php - - message: "#^Parameter \\#1 \\$fields of method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\ContentServiceTest\\:\\:assertAllFieldsEquals\\(\\) expects array\\, iterable\\ given\\.$#" count: 1 @@ -27560,11 +27020,6 @@ parameters: count: 1 path: tests/integration/Core/Repository/ContentServiceTest.php - - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, iterable\\ given\\.$#" - count: 1 - path: tests/integration/Core/Repository/ContentServiceTest.php - - message: "#^Parameter \\#1 \\$value of function count expects array\\|Countable, iterable\\ given\\.$#" count: 2 @@ -29890,41 +29345,16 @@ parameters: count: 1 path: tests/integration/Core/Repository/FieldType/MapLocationIntegrationTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationIntegrationTest\\:\\:assertCopiedFieldDataLoadedCorrectly\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationIntegrationTest\\:\\:assertFieldDataLoadedCorrect\\(\\) has no return type specified\\.$#" count: 1 path: tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationIntegrationTest\\:\\:assertUpdatedFieldDataLoadedCorrect\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationIntegrationTest\\:\\:assertUpdatedFieldDataLoadedCorrect\\(\\) should return array but return statement is missing\\.$#" - count: 1 - path: tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationIntegrationTest\\:\\:getSettingsSchema\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationIntegrationTest\\:\\:getValidUpdateFieldData\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationIntegrationTest\\:\\:getValidUpdateFieldData\\(\\) should return array but returns Ibexa\\\\Core\\\\FieldType\\\\Relation\\\\Value\\.$#" - count: 1 - path: tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationIntegrationTest\\:\\:getValidatorSchema\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -29980,51 +29410,16 @@ parameters: count: 1 path: tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php - - - message: "#^Parameter \\#1 \\$relations of method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationIntegrationTest\\:\\:normalizeRelations\\(\\) expects array\\, array\\ given\\.$#" - count: 5 - path: tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php - - - - message: "#^Parameter \\#1 \\$relations of method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationIntegrationTest\\:\\:normalizeRelations\\(\\) expects array\\, iterable\\ given\\.$#" - count: 5 - path: tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationListIntegrationTest\\:\\:assertCopiedFieldDataLoadedCorrectly\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationListIntegrationTest\\:\\:assertFieldDataLoadedCorrect\\(\\) has no return type specified\\.$#" count: 1 path: tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationListIntegrationTest\\:\\:assertUpdatedFieldDataLoadedCorrect\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationListIntegrationTest\\:\\:assertUpdatedFieldDataLoadedCorrect\\(\\) should return array but return statement is missing\\.$#" - count: 1 - path: tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationListIntegrationTest\\:\\:getSettingsSchema\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 path: tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationListIntegrationTest\\:\\:getValidUpdateFieldData\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationListIntegrationTest\\:\\:getValidUpdateFieldData\\(\\) should return array but returns Ibexa\\\\Core\\\\FieldType\\\\RelationList\\\\Value\\.$#" - count: 1 - path: tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationListIntegrationTest\\:\\:getValidatorSchema\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -30080,16 +29475,6 @@ parameters: count: 1 path: tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php - - - message: "#^Parameter \\#1 \\$relations of method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationListIntegrationTest\\:\\:normalizeRelations\\(\\) expects array\\, array\\ given\\.$#" - count: 5 - path: tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php - - - - message: "#^Parameter \\#1 \\$relations of method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\RelationListIntegrationTest\\:\\:normalizeRelations\\(\\) expects array\\, iterable\\ given\\.$#" - count: 5 - path: tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Integration\\\\Core\\\\Repository\\\\FieldType\\\\SearchBaseIntegrationTest\\:\\:assertFindResult\\(\\) has no return type specified\\.$#" count: 1 @@ -39406,7 +38791,7 @@ parameters: path: tests/lib/Base/Container/Compiler/Storage/Legacy/RoleLimitationConverterPassTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Base\\\\Container\\\\Compiler\\\\Stubs\\\\GatewayBasedStorageHandler\\:\\:deleteFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" + message: "#^Class Ibexa\\\\Tests\\\\Core\\\\Base\\\\Container\\\\Compiler\\\\Stubs\\\\GatewayBasedStorageHandler extends generic class Ibexa\\\\Contracts\\\\Core\\\\FieldType\\\\GatewayBasedStorage but does not specify its types\\: T$#" count: 1 path: tests/lib/Base/Container/Compiler/Stubs/GatewayBasedStorageHandler.php @@ -39425,26 +38810,11 @@ parameters: count: 1 path: tests/lib/Base/Container/Compiler/Stubs/GatewayBasedStorageHandler.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Base\\\\Container\\\\Compiler\\\\Stubs\\\\GatewayBasedStorageHandler\\:\\:getFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: tests/lib/Base/Container/Compiler/Stubs/GatewayBasedStorageHandler.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Base\\\\Container\\\\Compiler\\\\Stubs\\\\GatewayBasedStorageHandler\\:\\:getIndexData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: tests/lib/Base/Container/Compiler/Stubs/GatewayBasedStorageHandler.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Base\\\\Container\\\\Compiler\\\\Stubs\\\\GatewayBasedStorageHandler\\:\\:hasFieldData\\(\\) should return bool but return statement is missing\\.$#" count: 1 path: tests/lib/Base/Container/Compiler/Stubs/GatewayBasedStorageHandler.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Base\\\\Container\\\\Compiler\\\\Stubs\\\\GatewayBasedStorageHandler\\:\\:storeFieldData\\(\\) has parameter \\$context with no value type specified in iterable type array\\.$#" - count: 1 - path: tests/lib/Base/Container/Compiler/Stubs/GatewayBasedStorageHandler.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Base\\\\Container\\\\Compiler\\\\TaggedServiceIdsIterator\\\\DeprecationErrorCollector\\:\\:getErrors\\(\\) return type has no value type specified in iterable type array\\.$#" count: 1 @@ -42065,11 +41435,6 @@ parameters: count: 1 path: tests/lib/FieldType/Image/IO/LegacyTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\FieldType\\\\Image\\\\IO\\\\LegacyTest\\:\\:testGetExternalPath\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/FieldType/Image/IO/LegacyTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\FieldType\\\\Image\\\\IO\\\\LegacyTest\\:\\:testGetFileContents\\(\\) has no return type specified\\.$#" count: 1 @@ -42085,11 +41450,6 @@ parameters: count: 1 path: tests/lib/FieldType/Image/IO/LegacyTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\FieldType\\\\Image\\\\IO\\\\LegacyTest\\:\\:testGetInternalPath\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/FieldType/Image/IO/LegacyTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\FieldType\\\\Image\\\\IO\\\\LegacyTest\\:\\:testGetMimeType\\(\\) has no return type specified\\.$#" count: 1 @@ -42805,11 +42165,6 @@ parameters: count: 2 path: tests/lib/FieldType/Url/UrlStorageTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\FieldType\\\\Url\\\\UrlStorageTest\\:\\:getContext\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/lib/FieldType/Url/UrlStorageTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\FieldType\\\\Url\\\\UrlStorageTest\\:\\:testDeleteFieldData\\(\\) has no return type specified\\.$#" count: 1 @@ -43065,11 +42420,6 @@ parameters: count: 1 path: tests/lib/Helper/PreviewLocationProviderTest.php - - - message: "#^Property Ibexa\\\\Tests\\\\Core\\\\Helper\\\\PreviewLocationProviderTest\\:\\:\\$contentService \\(Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\LocationService&PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\) does not accept Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\ContentService&PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\.$#" - count: 1 - path: tests/lib/Helper/PreviewLocationProviderTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Helper\\\\TranslationHelperTest\\:\\:getTranslatedField\\(\\) has no return type specified\\.$#" count: 1 @@ -43175,11 +42525,6 @@ parameters: count: 1 path: tests/lib/Helper/TranslationHelperTest.php - - - message: "#^Parameter \\#1 \\$internalId of method Ibexa\\\\Core\\\\IO\\\\ConfigScopeChangeAwareIOService\\:\\:getExternalPath\\(\\) expects string, int given\\.$#" - count: 1 - path: tests/lib/IO/ConfigScopeChangeAwareIOServiceTest.php - - message: "#^Property Ibexa\\\\Tests\\\\Core\\\\IO\\\\ConfigScopeChangeAwareIOServiceTest\\:\\:\\$innerIOService \\(Ibexa\\\\Core\\\\IO\\\\ConfigScopeChangeAwareIOService&PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\) does not accept Ibexa\\\\Core\\\\IO\\\\IOServiceInterface&PHPUnit\\\\Framework\\\\MockObject\\\\MockObject\\.$#" count: 1 @@ -43365,26 +42710,11 @@ parameters: count: 1 path: tests/lib/IO/IOServiceTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\IO\\\\IOServiceTest\\:\\:testNewBinaryCreateStructFromUploadedFile\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/IO/IOServiceTest.php - - message: "#^Property Ibexa\\\\Contracts\\\\Core\\\\IO\\\\BinaryFile\\:\\:\\$size \\(int\\) does not accept int\\<0, max\\>\\|false\\.$#" count: 1 path: tests/lib/IO/IOServiceTest.php - - - message: "#^Unreachable statement \\- code above always terminates\\.$#" - count: 1 - path: tests/lib/IO/IOServiceTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\IO\\\\MetadataHandler\\\\ImageSizeTest\\:\\:testExtract\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/IO/MetadataHandler/ImageSizeTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\IO\\\\MimeTypeDetector\\\\FileInfoTest\\:\\:testGetFromBuffer\\(\\) has no return type specified\\.$#" count: 1 @@ -44650,21 +43980,6 @@ parameters: count: 2 path: tests/lib/MVC/Symfony/Controller/QueryRenderControllerTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\Event\\\\ContentCacheClearEventTest\\:\\:setLocationsToClear\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/MVC/Symfony/Event/ContentCacheClearEventTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\Event\\\\ContentCacheClearEventTest\\:\\:testAddLocationsToClear\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/MVC/Symfony/Event/ContentCacheClearEventTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\Event\\\\ContentCacheClearEventTest\\:\\:testConstruct\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/MVC/Symfony/Event/ContentCacheClearEventTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\Event\\\\RouteReferenceGenerationEventTest\\:\\:testConstruct\\(\\) has no return type specified\\.$#" count: 1 @@ -46205,21 +45520,6 @@ parameters: count: 1 path: tests/lib/MVC/Symfony/SiteAccess/RouterHostPortURITest.php - - - message: "#^Class Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\Matcher\\\\Regex\\\\Host constructor invoked with 2 parameters, 1 required\\.$#" - count: 1 - path: tests/lib/MVC/Symfony/SiteAccess/RouterHostRegexTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\RouterHostRegexTest\\:\\:matchProvider\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/lib/MVC/Symfony/SiteAccess/RouterHostRegexTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\RouterHostRegexTest\\:\\:testGetName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/MVC/Symfony/SiteAccess/RouterHostRegexTest.php - - message: "#^Class Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\Matcher\\\\HostText constructor invoked with 2 parameters, 1 required\\.$#" count: 1 @@ -46460,26 +45760,6 @@ parameters: count: 1 path: tests/lib/MVC/Symfony/SiteAccess/RouterURIElementTest.php - - - message: "#^Class Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\Matcher\\\\Regex\\\\URI constructor invoked with 2 parameters, 1 required\\.$#" - count: 1 - path: tests/lib/MVC/Symfony/SiteAccess/RouterURIRegexTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\RouterURIRegexTest\\:\\:matchProvider\\(\\) return type has no value type specified in iterable type array\\.$#" - count: 1 - path: tests/lib/MVC/Symfony/SiteAccess/RouterURIRegexTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\RouterURIRegexTest\\:\\:testGetName\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/MVC/Symfony/SiteAccess/RouterURIRegexTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\RouterURIRegexTest\\:\\:testSerialize\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/MVC/Symfony/SiteAccess/RouterURIRegexTest.php - - message: "#^Class Ibexa\\\\Core\\\\MVC\\\\Symfony\\\\SiteAccess\\\\Matcher\\\\URIText constructor invoked with 2 parameters, 1 required\\.$#" count: 1 @@ -47135,36 +46415,6 @@ parameters: count: 1 path: tests/lib/MVC/Symfony/View/VariableProviderRegistryTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\ViewManagerTest\\:\\:createContentViewProviderMocks\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/MVC/Symfony/View/ViewManagerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\ViewManagerTest\\:\\:createLocationViewProviderMocks\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/MVC/Symfony/View/ViewManagerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\ViewManagerTest\\:\\:testAddContentViewProvider\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/MVC/Symfony/View/ViewManagerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\ViewManagerTest\\:\\:testAddLocationViewProvider\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/MVC/Symfony/View/ViewManagerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\ViewManagerTest\\:\\:testContentViewProvidersPriority\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/MVC/Symfony/View/ViewManagerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\ViewManagerTest\\:\\:testLocationViewProvidersPriority\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/MVC/Symfony/View/ViewManagerTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\MVC\\\\Symfony\\\\View\\\\ViewManagerTest\\:\\:testRenderContent\\(\\) has no return type specified\\.$#" count: 1 @@ -54280,11 +53530,6 @@ parameters: count: 1 path: tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Decorator\\\\ContentServiceDecoratorTest\\:\\:testLoadContentDraftsDecorator\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Decorator\\\\ContentServiceDecoratorTest\\:\\:testLoadContentInfoByRemoteIdDecorator\\(\\) has no return type specified\\.$#" count: 1 @@ -54305,11 +53550,6 @@ parameters: count: 1 path: tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Decorator\\\\ContentServiceDecoratorTest\\:\\:testLoadRelationsDecorator\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Decorator\\\\ContentServiceDecoratorTest\\:\\:testLoadReverseRelationsDecorator\\(\\) has no return type specified\\.$#" count: 1 @@ -54370,11 +53610,6 @@ parameters: count: 1 path: tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php - - - message: "#^Parameter \\#1 \\$innerService of class class@anonymous/tests/lib/Repository/Decorator/ContentServiceDecoratorTest\\.php\\:35 constructor expects Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\ContentService, PHPUnit\\\\Framework\\\\MockObject\\\\MockObject given\\.$#" - count: 1 - path: tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php - - message: "#^Parameter \\#2 \\$locationCreateStructs of method Ibexa\\\\Contracts\\\\Core\\\\Repository\\\\ContentService\\:\\:createContent\\(\\) expects array\\, array\\ given\\.$#" count: 1 @@ -57160,121 +56395,6 @@ parameters: count: 1 path: tests/lib/Repository/Service/Mock/PermissionTest.php - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:getPermissionResolverMock\\(\\) has parameter \\$methods with no type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:mockServices\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:mockServices\\(\\) has parameter \\$criterionMock with no type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:mockServices\\(\\) has parameter \\$limitationCount with no type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:mockServices\\(\\) has parameter \\$permissionSets with no type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:providerForTestAddPermissionsCriterion\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:providerForTestAddPermissionsCriterionWithBooleanPermission\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:providerForTestGetPermissionsCriterion\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:providerForTestGetPermissionsCriterionBooleanPermissionSets\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:testAddPermissionsCriterion\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:testAddPermissionsCriterion\\(\\) has parameter \\$expectedCriterion with no type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:testAddPermissionsCriterion\\(\\) has parameter \\$givenCriterion with no type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:testAddPermissionsCriterion\\(\\) has parameter \\$permissionsCriterionMock with no type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:testAddPermissionsCriterionWithBooleanPermission\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:testAddPermissionsCriterionWithBooleanPermission\\(\\) has parameter \\$permissionsCriterion with no type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:testGetPermissionsCriterion\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:testGetPermissionsCriterion\\(\\) has parameter \\$criterionMock with no type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:testGetPermissionsCriterion\\(\\) has parameter \\$expectedCriterion with no type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:testGetPermissionsCriterion\\(\\) has parameter \\$limitationCount with no type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:testGetPermissionsCriterion\\(\\) has parameter \\$permissionSets with no type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:testGetPermissionsCriterionBooleanPermissionSets\\(\\) has no return type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Method Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:testGetPermissionsCriterionBooleanPermissionSets\\(\\) has parameter \\$permissionSets with no type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - - - message: "#^Property Ibexa\\\\Tests\\\\Core\\\\Repository\\\\Service\\\\Mock\\\\PermissionsCriterionHandlerTest\\:\\:\\$permissionResolverMock has no type specified\\.$#" - count: 1 - path: tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php - - message: "#^Call to an undefined method Ibexa\\\\Contracts\\\\Core\\\\Persistence\\\\Content\\\\Location\\\\Handler\\:\\:expects\\(\\)\\.$#" count: 2 diff --git a/src/bundle/Core/DependencyInjection/Configuration/Parser/Common.php b/src/bundle/Core/DependencyInjection/Configuration/Parser/Common.php index 1fd613b6f5..13e4695be9 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Parser/Common.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Parser/Common.php @@ -9,19 +9,13 @@ use Ibexa\Bundle\Core\DependencyInjection\Configuration\AbstractParser; use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface; -use Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorAwareInterface; -use Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorInterface; -use Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\ConfigSuggestion; use Symfony\Component\Config\Definition\Builder\NodeBuilder; /** * Configuration parser handling all basic configuration (aka "common"). */ -class Common extends AbstractParser implements SuggestionCollectorAwareInterface +class Common extends AbstractParser { - /** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorInterface */ - private $suggestionCollector; - /** * Adds semantic configuration definition. * @@ -31,28 +25,6 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) { $nodeBuilder ->scalarNode('repository')->info('The repository to use. Choose among ibexa.repositories.')->end() - // @deprecated - // Use ibexa.repositories / repository settings instead. - ->arrayNode('database') - ->info('DEPRECATED. Use ibexa.repositories / repository settings instead.') - ->children() - ->enumNode('type')->values(['mysql', 'pgsql', 'sqlite'])->info('The database driver. Can be mysql, pgsql or sqlite.')->end() - ->scalarNode('server')->end() - ->scalarNode('port')->end() - ->scalarNode('user')->cannotBeEmpty()->end() - ->scalarNode('password')->end() - ->scalarNode('database_name')->cannotBeEmpty()->end() - ->scalarNode('charset')->defaultValue('utf8')->end() - ->scalarNode('socket')->end() - ->arrayNode('options') - ->info('Arbitrary options, supported by your DB driver ("driver-opts" in PDO)') - ->example(['foo' => 'bar', 'someOptionName' => ['one', 'two', 'three']]) - ->useAttributeAsKey('key') - ->prototype('variable')->end() - ->end() - ->scalarNode('dsn')->info('Full database DSN. Will replace settings above.')->example('mysql://root:root@localhost:3306/ezdemo')->end() - ->end() - ->end() ->scalarNode('cache_service_name') ->example('cache.app') ->info('The cache pool service name to use for a siteaccess / siteaccess-group, *must* be present.') @@ -64,13 +36,7 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) ->end() ->arrayNode('api_keys') ->info('Collection of API keys') - ->addDefaultsIfNotSet() - ->children() - ->scalarNode('google_maps') - ->setDeprecated('The child node "%node%" at path "%path%" is no longer used and deprecated.') - ->info('Google Maps API Key, required as of Google Maps v3 to make sure maps show up correctly.') - ->end() - ->end() + ->scalarPrototype()->end() ->end() ->scalarNode('storage_dir') ->cannotBeEmpty() @@ -80,10 +46,6 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) ->cannotBeEmpty() ->info('Directory where binary files (from ezbinaryfile field type) are stored. Default value is "original"') ->end() - // @deprecated since 5.3. Will be removed in 6.x. - ->scalarNode('session_name') - ->info('DEPRECATED. Use session.name instead.') - ->end() ->arrayNode('session') ->info('Session options. Will override options defined in Symfony framework.session.*') ->children() @@ -98,11 +60,6 @@ public function addSemanticConfig(NodeBuilder $nodeBuilder) ->booleanNode('cookie_httponly')->end() ->end() ->end() - ->scalarNode('pagelayout') - ->info('The default layout to use') - ->example('AppBundle::pagelayout.html.twig') - ->setDeprecated('The "pagelayout" option is deprecated. Use "page_layout" instead.') - ->end() ->scalarNode('page_layout') ->info('The default layout to use') ->example('AppBundle::page_layout.html.twig') @@ -152,9 +109,6 @@ public function preMap(array $config, ContextualizerInterface $contextualizer) public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer) { - if (isset($scopeSettings['database'])) { - $this->addDatabaseConfigSuggestion($currentScope, $scopeSettings['database']); - } if (isset($scopeSettings['repository'])) { $contextualizer->setContextualParameter('repository', $currentScope, $scopeSettings['repository']); } @@ -176,19 +130,6 @@ public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerIn $contextualizer->setContextualParameter('api_keys.' . $key, $currentScope, $value); } - // session_name setting is deprecated in favor of session.name - $container = $contextualizer->getContainer(); - $sessionOptions = $container->hasParameter("ibexa.site_access.config.$currentScope.session") ? $container->getParameter("ibexa.site_access.config.$currentScope.session") : []; - if (isset($sessionOptions['name'])) { - $contextualizer->setContextualParameter('session_name', $currentScope, $sessionOptions['name']); - } - // @deprecated session_name is deprecated, but if present, in addition to session.name, consider it instead (BC). - if (isset($scopeSettings['session_name'])) { - $sessionOptions['name'] = $scopeSettings['session_name']; - $contextualizer->setContextualParameter('session_name', $currentScope, $scopeSettings['session_name']); - $contextualizer->setContextualParameter('session', $currentScope, $sessionOptions); - } - if (isset($scopeSettings['http_cache']['purge_servers'])) { $contextualizer->setContextualParameter('http_cache.purge_servers', $currentScope, $scopeSettings['http_cache']['purge_servers']); } @@ -207,100 +148,8 @@ public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerIn if (isset($scopeSettings['default_page'])) { $contextualizer->setContextualParameter('default_page', $currentScope, '/' . ltrim($scopeSettings['default_page'], '/')); } - if (isset($scopeSettings['pagelayout'])) { - // note: "pagelayout" is deprecated, deprecation message is set via Semantic Config Node Builder - $contextualizer->setContextualParameter('pagelayout', $currentScope, $scopeSettings['pagelayout']); - $contextualizer->setContextualParameter('page_layout', $currentScope, $scopeSettings['pagelayout']); - } if (isset($scopeSettings['page_layout'])) { - // note: "page_layout" as the new setting always takes precedence - $contextualizer->setContextualParameter('pagelayout', $currentScope, $scopeSettings['page_layout']); $contextualizer->setContextualParameter('page_layout', $currentScope, $scopeSettings['page_layout']); } } - - /** - * Injects SuggestionCollector. - * - * @param \Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorInterface $suggestionCollector - */ - public function setSuggestionCollector(SuggestionCollectorInterface $suggestionCollector) - { - $this->suggestionCollector = $suggestionCollector; - } - - private function addDatabaseConfigSuggestion($sa, array $databaseConfig) - { - $suggestion = new ConfigSuggestion( - <<setMandatory(true); - $suggestionArray = [ - 'driver' => 'pdo_mysql', - 'host' => 'localhost', - 'dbname' => 'my_database', - 'user' => 'my_user', - 'password' => 'some_password', - 'charset' => 'UTF8', - ]; - - if (!empty($databaseConfig)) { - $suggestionArray['dbname'] = $databaseConfig['database_name']; - $suggestionArray['host'] = $databaseConfig['server']; - $driverMap = [ - 'mysql' => 'pdo_mysql', - 'pgsql' => 'pdo_pgsql', - 'sqlite' => 'pdo_sqlite', - ]; - if (isset($driverMap[$databaseConfig['type']])) { - $suggestionArray['driver'] = $driverMap[$databaseConfig['type']]; - } else { - $suggestionArray['driver'] = $databaseConfig['type']; - } - if (isset($databaseConfig['socket'])) { - $suggestionArray['unix_socket'] = $databaseConfig['socket']; - } - $suggestionArray['options'] = $databaseConfig['options']; - $suggestionArray['user'] = $databaseConfig['user']; - $suggestionArray['password'] = $databaseConfig['password']; - } - $suggestion->setSuggestion( - [ - 'doctrine' => [ - 'dbal' => [ - 'connections' => [ - 'default' => $suggestionArray, - ], - ], - ], - 'ibexa' => [ - 'repositories' => [ - 'my_repository' => [ - 'storage' => [ - 'engine' => 'legacy', - 'connection' => 'default', - ], - 'search' => [ - 'engine' => 'legacy', - 'connection' => 'default', - ], - ], - ], - 'system' => [ - $sa => [ - 'repository' => 'my_repository', - ], - ], - ], - ] - ); - - $this->suggestionCollector->addSuggestion($suggestion); - } } diff --git a/src/bundle/Core/DependencyInjection/Configuration/Parser/Image.php b/src/bundle/Core/DependencyInjection/Configuration/Parser/Image.php index e3b62a3fb2..f58a18bd94 100644 --- a/src/bundle/Core/DependencyInjection/Configuration/Parser/Image.php +++ b/src/bundle/Core/DependencyInjection/Configuration/Parser/Image.php @@ -9,24 +9,13 @@ use Ibexa\Bundle\Core\DependencyInjection\Configuration\AbstractParser; use Ibexa\Bundle\Core\DependencyInjection\Configuration\SiteAccessAware\ContextualizerInterface; -use Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorAwareInterface; -use Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorInterface; -use Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\ConfigSuggestion; use Symfony\Component\Config\Definition\Builder\NodeBuilder; /** * Configuration parser handling all basic configuration (aka "Image"). */ -class Image extends AbstractParser implements SuggestionCollectorAwareInterface +class Image extends AbstractParser { - /** @var \Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorInterface */ - private $suggestionCollector; - - public function setSuggestionCollector(SuggestionCollectorInterface $suggestionCollector) - { - $this->suggestionCollector = $suggestionCollector; - } - /** * Adds semantic configuration definition. * @@ -35,13 +24,6 @@ public function setSuggestionCollector(SuggestionCollectorInterface $suggestionC public function addSemanticConfig(NodeBuilder $nodeBuilder) { $nodeBuilder - ->arrayNode('imagemagick') - ->info('DEPRECATED.') - ->children() - ->scalarNode('pre_parameters')->info('Parameters that must be run BEFORE the filenames and filters')->end() - ->scalarNode('post_parameters')->info('Parameters that must be run AFTER the filenames and filters')->end() - ->end() - ->end() ->arrayNode('image_variations') ->info('Configuration for your image variations (aka "image aliases")') ->example( @@ -119,7 +101,7 @@ static function ($v) { ->end() ->scalarNode('image_host') ->info('Images host. All system images URLs are prefixed with given host if configured.') - ->example('https://ezplatform.com') + ->example('https://ibexa.co') ->end(); } @@ -132,11 +114,5 @@ public function preMap(array $config, ContextualizerInterface $contextualizer) public function mapConfig(array &$scopeSettings, $currentScope, ContextualizerInterface $contextualizer) { - if (isset($scopeSettings['imagemagick'])) { - $suggestion = new ConfigSuggestion( - '"imagemagick" settings are deprecated. Just remove them from your configuration file.' - ); - $this->suggestionCollector->addSuggestion($suggestion); - } } } diff --git a/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php b/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php index c12b9024a7..2a99e00011 100644 --- a/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php +++ b/src/bundle/Core/DependencyInjection/IbexaCoreExtension.php @@ -130,7 +130,6 @@ public function load(array $configs, ContainerBuilder $container) $this->registerRepositoriesConfiguration($config, $container); $this->registerSiteAccessConfiguration($config, $container); - $this->registerImageMagickConfiguration($config, $container); $this->registerUrlAliasConfiguration($config, $container); $this->registerUrlWildcardsConfiguration($config, $container); $this->registerOrmConfiguration($config, $container); @@ -299,21 +298,6 @@ private function registerSiteAccessConfiguration(array $config, ContainerBuilder ConfigurationProcessor::setGroupsBySiteAccess($groupsBySiteaccess); } - private function registerImageMagickConfiguration(array $config, ContainerBuilder $container) - { - if (isset($config['imagemagick'])) { - $container->setParameter('ibexa.image.imagemagick.enabled', $config['imagemagick']['enabled']); - if ($config['imagemagick']['enabled']) { - $container->setParameter('ibexa.image.imagemagick.executable_path', dirname($config['imagemagick']['path'])); - $container->setParameter('ibexa.image.imagemagick.executable', basename($config['imagemagick']['path'])); - } - } - - $filters = isset($config['imagemagick']['filters']) ? $config['imagemagick']['filters'] : []; - $filters = $filters + $container->getParameter('ibexa.image.imagemagick.filters'); - $container->setParameter('ibexa.image.imagemagick.filters', $filters); - } - private function registerOrmConfiguration(array $config, ContainerBuilder $container): void { if (!isset($config['orm']['entity_mappings'])) { diff --git a/src/bundle/Core/DependencyInjection/Security/PolicyProvider/RepositoryPolicyProvider.php b/src/bundle/Core/DependencyInjection/Security/PolicyProvider/RepositoryPolicyProvider.php deleted file mode 100644 index ff267c0446..0000000000 --- a/src/bundle/Core/DependencyInjection/Security/PolicyProvider/RepositoryPolicyProvider.php +++ /dev/null @@ -1,19 +0,0 @@ -" - geometry/scalewidthdownonly: "-geometry {1}>" - geometry/scaleheightdownonly: "-geometry x{1}>" - geometry/scaleexact: "-geometry {1}x{2}!" - geometry/scalepercent: "-geometry {1}x{2}%" - geometry/crop: "-crop {1}x{2}+{3}+{4}" - filter/noise: "-noise {1}" - filter/swirl: "-swirl {1}" - colorspace/gray: "-colorspace GRAY" - colorspace/transparent: "-colorspace Transparent" - colorspace: "-colorspace {1}" - border: "-border {1}x{2}" - border/color: "-bordercolor rgb({1},{2},{3})" - border/width: "-borderwidth {1}" - flatten: "-flatten" - resize: "-resize {1}" - optimize: "-strip" - ibexa.site_access.config.default.image_host: '' ibexa.site_access.config.default.url_handler.http.options: diff --git a/src/bundle/Core/Resources/config/helpers.yml b/src/bundle/Core/Resources/config/helpers.yml index 1ea501e559..7683d75494 100644 --- a/src/bundle/Core/Resources/config/helpers.yml +++ b/src/bundle/Core/Resources/config/helpers.yml @@ -6,7 +6,6 @@ parameters: services: # Helpers Ibexa\Core\Helper\TranslationHelper: - class: Ibexa\Core\Helper\TranslationHelper arguments: - '@ibexa.config.resolver' - '@ibexa.api.service.content' @@ -14,32 +13,26 @@ services: - "@?logger" Ibexa\Core\Helper\FieldHelper: - class: Ibexa\Core\Helper\FieldHelper arguments: ['@Ibexa\Core\Helper\TranslationHelper', '@ibexa.api.service.content_type', '@ibexa.api.service.field_type'] Ibexa\Core\Helper\ContentPreviewHelper: - class: Ibexa\Core\Helper\ContentPreviewHelper arguments: ["@event_dispatcher", '@Ibexa\Core\MVC\Symfony\SiteAccess\Router'] calls: - [setSiteAccess, ['@Ibexa\Core\MVC\Symfony\SiteAccess']] Ibexa\Bundle\Core\EventListener\ConfigScopeListener: - class: Ibexa\Bundle\Core\EventListener\ConfigScopeListener arguments: $configResolvers: !tagged ibexa.site.config.resolver - $viewManager: '@Ibexa\Bundle\Core\View\Manager' + $viewManager: '@Ibexa\Core\MVC\Symfony\View\ViewManagerInterface' tags: - { name: kernel.event_subscriber } Ibexa\Core\Helper\PreviewLocationProvider: - class: Ibexa\Core\Helper\PreviewLocationProvider arguments: - '@ibexa.api.service.location' - - '@ibexa.api.service.content' - '@Ibexa\Core\Persistence\Cache\LocationHandler' Ibexa\Core\Helper\ContentInfoLocationLoader\SudoMainLocationLoader: - class: 'Ibexa\Core\Helper\ContentInfoLocationLoader\SudoMainLocationLoader' arguments: - '@ibexa.api.repository' diff --git a/src/bundle/Core/Resources/config/routing/serializers.yml b/src/bundle/Core/Resources/config/routing/serializers.yml index e59b680cba..62329fb916 100644 --- a/src/bundle/Core/Resources/config/routing/serializers.yml +++ b/src/bundle/Core/Resources/config/routing/serializers.yml @@ -11,8 +11,6 @@ services: - '@Ibexa\Core\MVC\Symfony\Component\Serializer\MapNormalizer' - '@Ibexa\Core\MVC\Symfony\Component\Serializer\URITextNormalizer' - '@Ibexa\Core\MVC\Symfony\Component\Serializer\HostTextNormalizer' - - '@Ibexa\Core\MVC\Symfony\Component\Serializer\RegexURINormalizer' - - '@Ibexa\Core\MVC\Symfony\Component\Serializer\RegexHostNormalizer' - '@Ibexa\Core\MVC\Symfony\Component\Serializer\RegexNormalizer' - '@Ibexa\Core\MVC\Symfony\Component\Serializer\URIElementNormalizer' - '@Ibexa\Core\MVC\Symfony\Component\Serializer\SimplifiedRequestNormalizer' @@ -45,10 +43,6 @@ services: Ibexa\Core\MVC\Symfony\Component\Serializer\HostTextNormalizer: ~ - Ibexa\Core\MVC\Symfony\Component\Serializer\RegexURINormalizer: ~ - - Ibexa\Core\MVC\Symfony\Component\Serializer\RegexHostNormalizer: ~ - Ibexa\Core\MVC\Symfony\Component\Serializer\RegexNormalizer: ~ Ibexa\Core\MVC\Symfony\Component\Serializer\URIElementNormalizer: ~ diff --git a/src/bundle/Core/Resources/config/services.yml b/src/bundle/Core/Resources/config/services.yml index a8a954686b..bb4f9b42c6 100644 --- a/src/bundle/Core/Resources/config/services.yml +++ b/src/bundle/Core/Resources/config/services.yml @@ -94,7 +94,7 @@ services: Ibexa\Core\MVC\Symfony\Controller\Content\ViewController: class: Ibexa\Core\MVC\Symfony\Controller\Content\ViewController arguments: - - '@Ibexa\Bundle\Core\View\Manager' + - '@Ibexa\Core\MVC\Symfony\View\ViewManagerInterface' - "@security.authorization_checker" parent: Ibexa\Core\MVC\Symfony\Controller\Controller tags: diff --git a/src/bundle/Core/Resources/config/session.yml b/src/bundle/Core/Resources/config/session.yml index 81b28b1bae..b32f3d9c69 100644 --- a/src/bundle/Core/Resources/config/session.yml +++ b/src/bundle/Core/Resources/config/session.yml @@ -1,6 +1,3 @@ -parameters: - ibexa.session.attribute_bag.storage_key: "_ezpublish" - services: Ibexa\Bundle\Core\EventListener\SessionSetDynamicNameListener: class: Ibexa\Bundle\Core\EventListener\SessionSetDynamicNameListener @@ -12,9 +9,3 @@ services: class: Ibexa\Bundle\Core\EventListener\SessionInitByPostListener tags: - { name: kernel.event_subscriber } - - # Override the session attribute bag to set custom storage key so same is used as legacy - # @deprecated To be removed in 7.0 kernel, see 594b083d94f1cff7008fb0d7d54f40d0ce0a2ace - session.attribute_bag: - class: Symfony\Component\HttpFoundation\Session\Attribute\AttributeBag - arguments: ['%ibexa.session.attribute_bag.storage_key%'] diff --git a/src/bundle/Core/Resources/config/templating.yml b/src/bundle/Core/Resources/config/templating.yml index ad7839456e..354dd37474 100644 --- a/src/bundle/Core/Resources/config/templating.yml +++ b/src/bundle/Core/Resources/config/templating.yml @@ -18,17 +18,6 @@ services: tags: - {name: twig.extension} - Ibexa\Bundle\Core\View\Manager: - class: Ibexa\Bundle\Core\View\Manager - arguments: - - "@twig" - - "@event_dispatcher" - - '@ibexa.siteaccessaware.repository' - - '@ibexa.config.resolver' - - '%ibexa.content_view.viewbase_layout%' - - '@Ibexa\Core\MVC\Symfony\View\Configurator\ViewProvider' - - "@?logger" - Ibexa\Contracts\Core\MVC\View\ViewMatcherRegistryInterface: alias: Ibexa\Bundle\Core\Matcher\ViewMatcherRegistry @@ -322,3 +311,12 @@ services: Ibexa\Core\MVC\Symfony\Templating\Twig\Extension\UserPreferenceRuntime: autowire: true autoconfigure: true + + Ibexa\Core\MVC\Symfony\View\Manager: + autowire: true + autoconfigure: true + arguments: + $viewBaseLayout: '%ibexa.content_view.viewbase_layout%' + $viewConfigurator: '@Ibexa\Core\MVC\Symfony\View\Configurator\ViewProvider' + + Ibexa\Core\MVC\Symfony\View\ViewManagerInterface: '@Ibexa\Core\MVC\Symfony\View\Manager' diff --git a/src/bundle/Core/Routing/DefaultRouter.php b/src/bundle/Core/Routing/DefaultRouter.php index a10f2dea5b..936e5a3688 100644 --- a/src/bundle/Core/Routing/DefaultRouter.php +++ b/src/bundle/Core/Routing/DefaultRouter.php @@ -160,27 +160,27 @@ protected function isSiteAccessAwareRoute($routeName): bool public function getContextBySimplifiedRequest(SimplifiedRequest $simplifiedRequest) { $context = clone $this->context; - if ($simplifiedRequest->scheme) { - $context->setScheme($simplifiedRequest->scheme); + if ($simplifiedRequest->getScheme()) { + $context->setScheme($simplifiedRequest->getScheme()); } - if ($simplifiedRequest->port) { - switch ($simplifiedRequest->scheme) { + if ($simplifiedRequest->getPort()) { + switch ($simplifiedRequest->getScheme()) { case 'https': - $context->setHttpsPort($simplifiedRequest->port); + $context->setHttpsPort($simplifiedRequest->getPort()); break; default: - $context->setHttpPort($simplifiedRequest->port); + $context->setHttpPort($simplifiedRequest->getPort()); break; } } - if ($simplifiedRequest->host) { - $context->setHost($simplifiedRequest->host); + if ($simplifiedRequest->getHost()) { + $context->setHost($simplifiedRequest->getHost()); } - if ($simplifiedRequest->pathinfo) { - $context->setPathInfo($simplifiedRequest->pathinfo); + if ($simplifiedRequest->getPathInfo()) { + $context->setPathInfo($simplifiedRequest->getPathInfo()); } return $context; diff --git a/src/bundle/Core/View/Manager.php b/src/bundle/Core/View/Manager.php deleted file mode 100644 index 7f3e601522..0000000000 --- a/src/bundle/Core/View/Manager.php +++ /dev/null @@ -1,39 +0,0 @@ -logger) { - $this->logger->debug('Changing SiteAccess in view providers'); - } - - $providers = array_merge( - $this->getAllLocationViewProviders(), - $this->getAllContentViewProviders() - ); - foreach ($providers as $provider) { - if ($provider instanceof SiteAccessAware) { - $provider->setSiteAccess($siteAccess); - } - } - } -} diff --git a/src/bundle/Debug/Collector/PersistenceCacheCollector.php b/src/bundle/Debug/Collector/PersistenceCacheCollector.php index 3ae2a39c6e..2231f202d1 100644 --- a/src/bundle/Debug/Collector/PersistenceCacheCollector.php +++ b/src/bundle/Debug/Collector/PersistenceCacheCollector.php @@ -40,18 +40,6 @@ public function getName(): string return 'ezpublish.debug.persistence'; } - /** - * Returns call count. - * - * @deprecated since 7.5, use getStats(). - * - * @return int - */ - public function getCount() - { - return $this->data['stats']['call'] + $this->data['stats']['miss']; - } - /** * Returns stats on Persistance cache usage. * diff --git a/src/bundle/RepositoryInstaller/Installer/CoreInstaller.php b/src/bundle/RepositoryInstaller/Installer/CoreInstaller.php index 4b4ffb6bb4..6351c6cc62 100644 --- a/src/bundle/RepositoryInstaller/Installer/CoreInstaller.php +++ b/src/bundle/RepositoryInstaller/Installer/CoreInstaller.php @@ -117,11 +117,4 @@ protected function getDropSqlStatementsForExistingSchema( public function importBinaries() { } - - /** - * {@inheritdoc} - */ - public function createConfiguration() - { - } } diff --git a/src/bundle/RepositoryInstaller/Installer/Installer.php b/src/bundle/RepositoryInstaller/Installer/Installer.php index 5318ea42b6..217249064a 100644 --- a/src/bundle/RepositoryInstaller/Installer/Installer.php +++ b/src/bundle/RepositoryInstaller/Installer/Installer.php @@ -27,11 +27,6 @@ public function importSchema(); */ public function importData(); - /** - * @deprecated Inactive since 6.1, further info: https://issues.ibexa.co/browse/EZP-25369 - */ - public function createConfiguration(); - /** * Handle optional import of binary files to var folder. */ diff --git a/src/contracts/FieldType/BinaryBase/PathGenerator.php b/src/contracts/FieldType/BinaryBase/PathGenerator.php deleted file mode 100644 index 637f385d34..0000000000 --- a/src/contracts/FieldType/BinaryBase/PathGenerator.php +++ /dev/null @@ -1,19 +0,0 @@ -storeFieldData($versionInfo, $field, $context); + return $this->storeFieldData($versionInfo, $field); } } diff --git a/src/contracts/IO/BinaryFile.php b/src/contracts/IO/BinaryFile.php index 45dcb7aa28..d65f2ac209 100644 --- a/src/contracts/IO/BinaryFile.php +++ b/src/contracts/IO/BinaryFile.php @@ -43,15 +43,4 @@ class BinaryFile * @var string */ public $uri; - - /** - * The file's mime type. - * - * Example: text/xml - * - * @deprecated Since 5.3.3, use IO\Handler::getMimeType() - * - * @var string - */ - public $mimeType; } diff --git a/src/contracts/Repository/ContentService.php b/src/contracts/Repository/ContentService.php index 8a8cfed0d0..02ffa68135 100644 --- a/src/contracts/Repository/ContentService.php +++ b/src/contracts/Repository/ContentService.php @@ -287,21 +287,6 @@ public function createContentDraft( */ public function countContentDrafts(?User $user = null): int; - /** - * Loads drafts for a user. - * - * If no user is given the drafts for the authenticated user are returned - * - * @deprecated Please use {@see ContentService::loadContentDraftList()} instead to avoid risking loading too much data. - * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException if the current-user is not allowed to load the draft list - * - * @param \Ibexa\Contracts\Core\Repository\Values\User\User $user The user to load drafts for, if defined, otherwise drafts for current-user - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo[] the drafts ({@see VersionInfo}) owned by the given user - */ - public function loadContentDrafts(?User $user = null): iterable; - /** * Loads drafts for a user when content is not in the trash. The list is sorted by modification date. * @@ -396,17 +381,6 @@ public function loadVersions(ContentInfo $contentInfo, ?int $status = null): ite */ public function copyContent(ContentInfo $contentInfo, LocationCreateStruct $destinationLocationCreateStruct, ?VersionInfo $versionInfo = null): Content; - /** - * Loads all outgoing relations for the given version. - * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException if the user is not allowed to read this version - * - * @deprecated 4.5.7 The "ContentService::loadRelations()" method is deprecated, will be removed in 5.0. - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Relation[] - */ - public function loadRelations(VersionInfo $versionInfo): iterable; - /** * Loads all outgoing relations for the given version. * diff --git a/src/contracts/Repository/Decorator/ContentServiceDecorator.php b/src/contracts/Repository/Decorator/ContentServiceDecorator.php index 3a65123467..fdf280423d 100644 --- a/src/contracts/Repository/Decorator/ContentServiceDecorator.php +++ b/src/contracts/Repository/Decorator/ContentServiceDecorator.php @@ -148,11 +148,6 @@ public function countContentDrafts(User $user = null): int return $this->innerService->countContentDrafts($user); } - public function loadContentDrafts(?User $user = null): iterable - { - return $this->innerService->loadContentDrafts($user); - } - public function loadContentDraftList(?User $user = null, int $offset = 0, int $limit = -1): ContentDraftList { return $this->innerService->loadContentDraftList($user, $offset, $limit); @@ -189,11 +184,6 @@ public function copyContent( return $this->innerService->copyContent($contentInfo, $destinationLocationCreateStruct, $versionInfo); } - public function loadRelations(VersionInfo $versionInfo): iterable - { - return $this->innerService->loadRelations($versionInfo); - } - public function countRelations(VersionInfo $versionInfo, ?RelationType $type = null): int { return $this->innerService->countRelations($versionInfo, $type); diff --git a/src/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPass.php b/src/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPass.php index c22370951d..0d999b2a34 100644 --- a/src/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPass.php +++ b/src/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPass.php @@ -7,7 +7,6 @@ namespace Ibexa\Core\Base\Container\Compiler\Storage; -use Ibexa\Core\FieldType\GatewayBasedStorage; use Ibexa\Core\Persistence\Legacy\Content\StorageRegistry; use LogicException; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; @@ -89,41 +88,6 @@ public function process(ContainerBuilder $container) ); } - // If the storage handler is gateway based, then we need to add a corresponding gateway to it. - // Will throw a LogicException if no gateway is defined for this field type. - $storageHandlerDef = $container->findDefinition($serviceId); - $storageHandlerClass = $storageHandlerDef->getClass(); - if (preg_match('/^%([^%\s]+)%$/', (string)$storageHandlerClass, $match)) { - $storageHandlerClass = $container->getParameter($match[1]); - } - - if ( - is_subclass_of( - $storageHandlerClass, - GatewayBasedStorage::class - ) - ) { - if (!isset($externalStorageGateways[$attribute['alias']])) { - throw new LogicException( - sprintf( - 'External storage handler "%s" for Field Type "%s" needs a storage gateway. ' . - 'Consider defining a storage gateway as a service for this Field Type and add the "%s" tag', - $serviceId, - $attribute['alias'], - self::EXTERNAL_STORAGE_HANDLER_GATEWAY_SERVICE_TAG - ) - ); - } - - $storageHandlerDef->addMethodCall( - 'addGateway', - [ - $externalStorageGateways[$attribute['alias']]['identifier'], - new Reference($externalStorageGateways[$attribute['alias']]['id']), - ] - ); - } - $externalStorageRegistryDefinition->addMethodCall( 'register', [ diff --git a/src/lib/Event/UserService.php b/src/lib/Event/UserService.php index 3b8c97bb51..94b7346d1f 100644 --- a/src/lib/Event/UserService.php +++ b/src/lib/Event/UserService.php @@ -234,23 +234,6 @@ public function updateUserPassword( User $user, string $newPassword ): User { - $eventData = [ - $user, - new UserUpdateStruct([ - 'password' => $newPassword, - ]), - ]; - - /** - * @deprecated since eZ Platform by Ibexa v3.1. listening on BeforeUpdateUserEvent when updating password has been deprecated. Use BeforeUpdateUserPasswordEvent instead. - */ - $beforeEvent = new BeforeUpdateUserEvent(...$eventData); - - $this->eventDispatcher->dispatch($beforeEvent); - if ($beforeEvent->isPropagationStopped()) { - return $beforeEvent->getUpdatedUser(); - } - $beforePasswordEvent = new BeforeUpdateUserPasswordEvent($user, $newPassword); $this->eventDispatcher->dispatch($beforePasswordEvent); @@ -258,22 +241,12 @@ public function updateUserPassword( return $beforePasswordEvent->getUpdatedUser(); } - if ($beforeEvent->hasUpdatedUser()) { - $updatedUser = $beforeEvent->getUpdatedUser(); - } elseif ($beforePasswordEvent->hasUpdatedUser()) { + if ($beforePasswordEvent->hasUpdatedUser()) { $updatedUser = $beforePasswordEvent->getUpdatedUser(); } else { $updatedUser = $this->innerService->updateUserPassword($user, $newPassword); } - /** - * @deprecated since eZ Platform by Ibexa v3.1. Listening on UpdateUserEvent when updating password has been deprecated. Use UpdateUserPasswordEvent instead. - */ - $afterEvent = new UpdateUserEvent($updatedUser, ...$eventData); - $this->eventDispatcher->dispatch( - $afterEvent - ); - $afterPasswordEvent = new UpdateUserPasswordEvent($updatedUser, $user, $newPassword); $this->eventDispatcher->dispatch( $afterPasswordEvent diff --git a/src/lib/FieldType/BinaryBase/BinaryBaseStorage.php b/src/lib/FieldType/BinaryBase/BinaryBaseStorage.php index e60f6b35f8..7a19ebb623 100644 --- a/src/lib/FieldType/BinaryBase/BinaryBaseStorage.php +++ b/src/lib/FieldType/BinaryBase/BinaryBaseStorage.php @@ -7,7 +7,7 @@ namespace Ibexa\Core\FieldType\BinaryBase; -use Ibexa\Contracts\Core\FieldType\BinaryBase\PathGenerator; +use Ibexa\Contracts\Core\FieldType\BinaryBase\PathGeneratorInterface; use Ibexa\Contracts\Core\FieldType\BinaryBase\RouteAwarePathGenerator; use Ibexa\Contracts\Core\FieldType\GatewayBasedStorage; use Ibexa\Contracts\Core\FieldType\StorageGatewayInterface; @@ -30,14 +30,12 @@ class BinaryBaseStorage extends GatewayBasedStorage */ protected $ioService; - /** @var \Ibexa\Contracts\Core\FieldType\BinaryBase\PathGenerator */ - protected $pathGenerator; + protected PathGeneratorInterface $pathGenerator; /** @var \Ibexa\Contracts\Core\IO\MimeTypeDetector */ protected $mimeTypeDetector; - /** @var \Ibexa\Contracts\Core\FieldType\BinaryBase\PathGenerator */ - protected $downloadUrlGenerator; + protected PathGeneratorInterface $downloadUrlGenerator; /** @var \Ibexa\Core\FieldType\BinaryBase\BinaryBaseStorage\Gateway */ protected $gateway; @@ -48,7 +46,7 @@ class BinaryBaseStorage extends GatewayBasedStorage public function __construct( StorageGatewayInterface $gateway, IOServiceInterface $ioService, - PathGenerator $pathGenerator, + PathGeneratorInterface $pathGenerator, MimeTypeDetector $mimeTypeDetector, FileExtensionBlackListValidator $fileExtensionBlackListValidator ) { @@ -59,10 +57,7 @@ public function __construct( $this->fileExtensionBlackListValidator = $fileExtensionBlackListValidator; } - /** - * @param \Ibexa\Contracts\Core\FieldType\BinaryBase\PathGenerator $downloadUrlGenerator - */ - public function setDownloadUrlGenerator(PathGenerator $downloadUrlGenerator) + public function setDownloadUrlGenerator(PathGeneratorInterface $downloadUrlGenerator) { $this->downloadUrlGenerator = $downloadUrlGenerator; } @@ -71,10 +66,10 @@ public function setDownloadUrlGenerator(PathGenerator $downloadUrlGenerator) * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException */ - public function storeFieldData(VersionInfo $versionInfo, Field $field, array $context) + public function storeFieldData(VersionInfo $versionInfo, Field $field) { if ($field->value->externalData === null) { - $this->deleteFieldData($versionInfo, [$field->id], $context); + $this->deleteFieldData($versionInfo, [$field->id]); return false; } @@ -110,13 +105,13 @@ public function storeFieldData(VersionInfo $versionInfo, Field $field, array $co $referenced = $this->gateway->getReferencedFiles([$field->id], $versionInfo->versionNo); if ($referenced === null || !in_array($field->value->externalData['id'], $referenced)) { - $this->removeOldFile($field->id, $versionInfo->versionNo, $context); + $this->removeOldFile($field->id, $versionInfo->versionNo); } $this->gateway->storeFileReference($versionInfo, $field); } - public function copyLegacyField(VersionInfo $versionInfo, Field $field, Field $originalField, array $context) + public function copyLegacyField(VersionInfo $versionInfo, Field $field, Field $originalField) { if ($originalField->value->externalData === null) { return false; @@ -136,9 +131,8 @@ public function copyLegacyField(VersionInfo $versionInfo, Field $field, Field $o * * @param mixed $fieldId * @param string $versionNo - * @param array $context */ - protected function removeOldFile($fieldId, $versionNo, array $context) + protected function removeOldFile($fieldId, $versionNo) { $fileReference = $this->gateway->getFileReferenceData($fieldId, $versionNo); if ($fileReference === null) { @@ -156,7 +150,7 @@ protected function removeOldFile($fieldId, $versionNo, array $context) } } - public function getFieldData(VersionInfo $versionInfo, Field $field, array $context) + public function getFieldData(VersionInfo $versionInfo, Field $field) { $field->value->externalData = $this->gateway->getFileReferenceData($field->id, $versionInfo->versionNo); if ($field->value->externalData !== null) { @@ -180,7 +174,7 @@ public function getFieldData(VersionInfo $versionInfo, Field $field, array $cont } } - public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array $context) + public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds) { if (empty($fieldIds)) { return; @@ -204,9 +198,4 @@ public function hasFieldData() { return true; } - - public function getIndexData(VersionInfo $versionInfo, Field $field, array $context): array - { - return []; - } } diff --git a/src/lib/FieldType/BinaryBase/PathGenerator/LegacyPathGenerator.php b/src/lib/FieldType/BinaryBase/PathGenerator/LegacyPathGenerator.php index 46f6d1fcae..eaf8eda86c 100644 --- a/src/lib/FieldType/BinaryBase/PathGenerator/LegacyPathGenerator.php +++ b/src/lib/FieldType/BinaryBase/PathGenerator/LegacyPathGenerator.php @@ -7,11 +7,11 @@ namespace Ibexa\Core\FieldType\BinaryBase\PathGenerator; -use Ibexa\Contracts\Core\FieldType\BinaryBase\PathGenerator; +use Ibexa\Contracts\Core\FieldType\BinaryBase\PathGeneratorInterface; use Ibexa\Contracts\Core\Persistence\Content\Field; use Ibexa\Contracts\Core\Persistence\Content\VersionInfo; -class LegacyPathGenerator extends PathGenerator +class LegacyPathGenerator implements PathGeneratorInterface { public function getStoragePathForField(Field $field, VersionInfo $versionInfo): string { diff --git a/src/lib/FieldType/GatewayBasedStorage.php b/src/lib/FieldType/GatewayBasedStorage.php deleted file mode 100644 index bc75fbdb97..0000000000 --- a/src/lib/FieldType/GatewayBasedStorage.php +++ /dev/null @@ -1,118 +0,0 @@ - $gateway) { - $this->addGateway($identifier, $gateway); - } - } - - /** - * Adds a storage $gateway assigned to the given $identifier. - * - * @param string $identifier - * @param \Ibexa\Core\FieldType\StorageGateway $gateway - */ - public function addGateway($identifier, StorageGateway $gateway) - { - $this->gateways[$identifier] = $gateway; - } - - /** - * Retrieve the fitting gateway, base on the identifier in $context. - * - * @deprecated Since 6.11. Retrieving gateway based on $context is deprecated - * and will be removed in 7.0. Inject gateway directly into FieldStorage - * - * @param array $context - * - * @return \Ibexa\Core\FieldType\StorageGateway - */ - protected function getGateway(array $context) - { - @trigger_error( - sprintf( - '%s: Retrieving gateway based on $context is deprecated and will be removed in 7.0. Inject gateway directly into FieldStorage', - static::class - ), - E_USER_DEPRECATED - ); - - if (!isset($this->gateways[$context['identifier']])) { - throw new \OutOfBoundsException("No gateway for {$context['identifier']} available."); - } - - $gateway = $this->gateways[$context['identifier']]; - $gateway->setConnection($context['connection']); - - return $gateway; - } - - /** - * This method is used exclusively by Legacy Storage to copy external data of existing field in main language to - * the untranslatable field not passed in create or update struct, but created implicitly in storage layer. - * - * By default the method falls back to the {@link \Ibexa\Contracts\Core\FieldType\FieldStorage::storeFieldData()}. - * External storages implement this method as needed. - * - * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo - * @param \Ibexa\Contracts\Core\Persistence\Content\Field $field - * @param \Ibexa\Contracts\Core\Persistence\Content\Field $originalField - * @param array $context - * - * @return bool|null Same as {@link \Ibexa\Contracts\Core\FieldType\FieldStorage::storeFieldData()}. - */ - public function copyLegacyField(VersionInfo $versionInfo, Field $field, Field $originalField, array $context) - { - return $this->storeFieldData($versionInfo, $field, $context); - } -} diff --git a/src/lib/FieldType/Image/IO/Legacy.php b/src/lib/FieldType/Image/IO/Legacy.php index ba53f07518..f4e691cc98 100644 --- a/src/lib/FieldType/Image/IO/Legacy.php +++ b/src/lib/FieldType/Image/IO/Legacy.php @@ -103,11 +103,6 @@ private function setPrefixes() $this->publishedPrefix = implode('/', array_merge($pathArray, [$this->optionsProvider->getPublishedImagesDir()])); } - public function getExternalPath($internalId) - { - return $this->publishedIOService->getExternalPath($internalId); - } - public function newBinaryCreateStructFromLocalFile($localFile) { return $this->publishedIOService->newBinaryCreateStructFromLocalFile($localFile); @@ -118,21 +113,16 @@ public function exists($binaryFileId) return $this->publishedIOService->exists($binaryFileId); } - public function getInternalPath($externalId) - { - return $this->publishedIOService->getInternalPath($externalId); - } - public function loadBinaryFile($binaryFileId) { // If the id is an internal (absolute) path to a draft image, use the draft service to get external path & load if ($this->isDraftImagePath($binaryFileId)) { - return $this->draftIOService->loadBinaryFile($this->draftIOService->getExternalPath($binaryFileId)); + return $this->draftIOService->loadBinaryFileByUri($binaryFileId); } // If the id is an internal path (absolute) to a published image, replace with the internal path if ($this->isPublishedImagePath($binaryFileId)) { - $binaryFileId = $this->publishedIOService->getExternalPath($binaryFileId); + return $this->publishedIOService->loadBinaryFileByUri($binaryFileId); } try { @@ -199,12 +189,14 @@ public function getMimeType($binaryFileId) { // If the id is an internal (absolute) path to a draft image, use the draft service to get external path & load if ($this->isDraftImagePath($binaryFileId)) { - return $this->draftIOService->getMimeType($this->draftIOService->getExternalPath($binaryFileId)); + return $this->draftIOService->getMimeType( + $this->draftIOService->loadBinaryFileByUri($binaryFileId)->id + ); } // If the id is an internal path (absolute) to a published image, replace with the internal path if ($this->isPublishedImagePath($binaryFileId)) { - $binaryFileId = $this->publishedIOService->getExternalPath($binaryFileId); + $binaryFileId = $this->publishedIOService->loadBinaryFileByUri($binaryFileId)->id; } if ($this->draftIOService->exists($binaryFileId)) { diff --git a/src/lib/FieldType/Image/ImageStorage.php b/src/lib/FieldType/Image/ImageStorage.php index 9da6b9b5b2..6b62d5736c 100644 --- a/src/lib/FieldType/Image/ImageStorage.php +++ b/src/lib/FieldType/Image/ImageStorage.php @@ -16,7 +16,6 @@ use Ibexa\Core\FieldType\Validator\FileExtensionBlackListValidator; use Ibexa\Core\IO\FilePathNormalizerInterface; use Ibexa\Core\IO\IOServiceInterface; -use Ibexa\Core\IO\MetadataHandler; /** * Converter for Image field type external storage. @@ -29,9 +28,6 @@ class ImageStorage extends GatewayBasedStorage /** @var \Ibexa\Core\FieldType\Image\PathGenerator */ protected $pathGenerator; - /** @var \Ibexa\Core\IO\MetadataHandler */ - protected $imageSizeMetadataHandler; - /** @var \Ibexa\Core\FieldType\Image\AliasCleanerInterface */ protected $aliasCleaner; @@ -48,7 +44,6 @@ public function __construct( StorageGatewayInterface $gateway, IOServiceInterface $ioService, PathGenerator $pathGenerator, - MetadataHandler $imageSizeMetadataHandler, AliasCleanerInterface $aliasCleaner, FilePathNormalizerInterface $filePathNormalizer, FileExtensionBlackListValidator $fileExtensionBlackListValidator @@ -56,7 +51,6 @@ public function __construct( parent::__construct($gateway); $this->ioService = $ioService; $this->pathGenerator = $pathGenerator; - $this->imageSizeMetadataHandler = $imageSizeMetadataHandler; $this->aliasCleaner = $aliasCleaner; $this->filePathNormalizer = $filePathNormalizer; $this->fileExtensionBlackListValidator = $fileExtensionBlackListValidator; @@ -67,7 +61,7 @@ public function __construct( * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException * @throws \Ibexa\Contracts\Core\Repository\Exceptions\ContentFieldValidationException */ - public function storeFieldData(VersionInfo $versionInfo, Field $field, array $context): bool + public function storeFieldData(VersionInfo $versionInfo, Field $field): bool { $contentMetaData = [ 'fieldId' => $field->id, @@ -153,7 +147,7 @@ public function storeFieldData(VersionInfo $versionInfo, Field $field, array $co return true; } - public function getFieldData(VersionInfo $versionInfo, Field $field, array $context) + public function getFieldData(VersionInfo $versionInfo, Field $field) { if ($field->value->data !== null) { $field->value->data['imageId'] = $this->buildImageId($versionInfo, $field); @@ -164,7 +158,7 @@ public function getFieldData(VersionInfo $versionInfo, Field $field, array $cont } } - public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array $context) + public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds) { $fieldXmls = $this->gateway->getXmlForImages($versionInfo->versionNo, $fieldIds); @@ -192,11 +186,6 @@ public function hasFieldData(): bool return true; } - public function getIndexData(VersionInfo $versionInfo, Field $field, array $context): array - { - return []; - } - /** * @return string */ diff --git a/src/lib/FieldType/Keyword/KeywordStorage.php b/src/lib/FieldType/Keyword/KeywordStorage.php index c91fbd634c..6fe2a16422 100644 --- a/src/lib/FieldType/Keyword/KeywordStorage.php +++ b/src/lib/FieldType/Keyword/KeywordStorage.php @@ -26,33 +26,24 @@ class KeywordStorage extends GatewayBasedStorage /** * @see \Ibexa\Contracts\Core\FieldType\FieldStorage * - * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo - * @param \Ibexa\Contracts\Core\Persistence\Content\Field $field - * @param array $context - * * @return mixed */ - public function storeFieldData(VersionInfo $versionInfo, Field $field, array $context) + public function storeFieldData(VersionInfo $versionInfo, Field $field) { $contentTypeId = $this->gateway->getContentTypeId($field); return $this->gateway->storeFieldData($field, $contentTypeId); } - public function getFieldData(VersionInfo $versionInfo, Field $field, array $context) + public function getFieldData(VersionInfo $versionInfo, Field $field) { - // @todo: This should already retrieve the ContentType ID return $this->gateway->getFieldData($field); } /** - * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo * @param array $fieldIds - * @param array $context - * - * @return bool */ - public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array $context): bool + public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds): bool { foreach ($fieldIds as $fieldId) { $this->gateway->deleteFieldData($fieldId, $versionInfo->versionNo); @@ -61,18 +52,8 @@ public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array return true; } - /** - * Checks if field type has external data to deal with. - * - * @return bool - */ public function hasFieldData(): bool { return true; } - - public function getIndexData(VersionInfo $versionInfo, Field $field, array $context): array - { - return []; - } } diff --git a/src/lib/FieldType/MapLocation/MapLocationStorage.php b/src/lib/FieldType/MapLocation/MapLocationStorage.php index a233abbd58..21b957df0a 100644 --- a/src/lib/FieldType/MapLocation/MapLocationStorage.php +++ b/src/lib/FieldType/MapLocation/MapLocationStorage.php @@ -19,50 +19,23 @@ class MapLocationStorage extends GatewayBasedStorage /** @var \Ibexa\Core\FieldType\MapLocation\MapLocationStorage\Gateway */ protected $gateway; - /** - * @see \Ibexa\Contracts\Core\FieldType\FieldStorage - * - * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo - * @param \Ibexa\Contracts\Core\Persistence\Content\Field $field - * @param array $context - * - * @return mixed - */ - public function storeFieldData(VersionInfo $versionInfo, Field $field, array $context) + public function storeFieldData(VersionInfo $versionInfo, Field $field) { return $this->gateway->storeFieldData($versionInfo, $field); } - public function getFieldData(VersionInfo $versionInfo, Field $field, array $context) + public function getFieldData(VersionInfo $versionInfo, Field $field) { $this->gateway->getFieldData($versionInfo, $field); } - /** - * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo - * @param array $fieldIds - * @param array $context - * - * @return bool - */ - public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array $context) + public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds) { $this->gateway->deleteFieldData($versionInfo, $fieldIds); } - /** - * Checks if field type has external data to deal with. - * - * @return bool - */ public function hasFieldData(): bool { return true; } - - public function getIndexData(VersionInfo $versionInfo, Field $field, array $context): array - { - // Handled by @see \Ibexa\Core\FieldType\MapLocation\SearchField::getIndexData() - return []; - } } diff --git a/src/lib/FieldType/NullStorage.php b/src/lib/FieldType/NullStorage.php index cf5a574472..5b3e6a79bf 100644 --- a/src/lib/FieldType/NullStorage.php +++ b/src/lib/FieldType/NullStorage.php @@ -19,7 +19,7 @@ class NullStorage implements FieldStorage /** * @see \Ibexa\Contracts\Core\FieldType\FieldStorage::storeFieldData() */ - public function storeFieldData(VersionInfo $versionInfo, Field $field, array $context): bool + public function storeFieldData(VersionInfo $versionInfo, Field $field): bool { return false; } @@ -27,7 +27,7 @@ public function storeFieldData(VersionInfo $versionInfo, Field $field, array $co /** * @see \Ibexa\Contracts\Core\FieldType\FieldStorage::getFieldData() */ - public function getFieldData(VersionInfo $versionInfo, Field $field, array $context) + public function getFieldData(VersionInfo $versionInfo, Field $field) { return; } @@ -35,7 +35,7 @@ public function getFieldData(VersionInfo $versionInfo, Field $field, array $cont /** * @see \Ibexa\Contracts\Core\FieldType\FieldStorage::deleteFieldData() */ - public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array $context): bool + public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds): bool { return true; } @@ -50,11 +50,6 @@ public function hasFieldData(): bool return false; } - public function getIndexData(VersionInfo $versionInfo, Field $field, array $context): array - { - return []; - } - /** * This method is used exclusively by Legacy Storage to copy external data of existing field in main language to * the untranslatable field not passed in create or update struct, but created implicitly in storage layer. @@ -65,11 +60,10 @@ public function getIndexData(VersionInfo $versionInfo, Field $field, array $cont * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo * @param \Ibexa\Contracts\Core\Persistence\Content\Field $field * @param \Ibexa\Contracts\Core\Persistence\Content\Field $originalField - * @param array $context * * @return bool|null Same as {@link \Ibexa\Contracts\Core\FieldType\FieldStorage::storeFieldData()}. */ - public function copyLegacyField(VersionInfo $versionInfo, Field $field, Field $originalField, array $context) + public function copyLegacyField(VersionInfo $versionInfo, Field $field, Field $originalField) { return; } diff --git a/src/lib/FieldType/Url/UrlStorage.php b/src/lib/FieldType/Url/UrlStorage.php index b1ac1f0186..bcc76eb135 100644 --- a/src/lib/FieldType/Url/UrlStorage.php +++ b/src/lib/FieldType/Url/UrlStorage.php @@ -36,7 +36,7 @@ public function __construct(StorageGatewayInterface $gateway, LoggerInterface $l $this->logger = $logger; } - public function storeFieldData(VersionInfo $versionInfo, Field $field, array $context): bool + public function storeFieldData(VersionInfo $versionInfo, Field $field): bool { $url = $field->value->externalData; @@ -62,7 +62,7 @@ public function storeFieldData(VersionInfo $versionInfo, Field $field, array $co return true; } - public function getFieldData(VersionInfo $versionInfo, Field $field, array $context) + public function getFieldData(VersionInfo $versionInfo, Field $field) { $id = $field->value->data['urlId']; if (empty($id)) { @@ -81,17 +81,7 @@ public function getFieldData(VersionInfo $versionInfo, Field $field, array $cont $field->value->externalData = isset($map[$id]) ? $map[$id] : ''; } - /** - * Deletes field data for all $fieldIds in the version identified by - * $versionInfo. - * - * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo - * @param array $fieldIds - * @param array $context - * - * @return bool - */ - public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array $context) + public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds) { foreach ($fieldIds as $fieldId) { $this->gateway->unlinkUrl($fieldId, $versionInfo->versionNo); @@ -107,9 +97,4 @@ public function hasFieldData(): bool { return true; } - - public function getIndexData(VersionInfo $versionInfo, Field $field, array $context): array - { - return []; - } } diff --git a/src/lib/FieldType/User/UserStorage.php b/src/lib/FieldType/User/UserStorage.php index 8443ccfe57..e09ef60329 100644 --- a/src/lib/FieldType/User/UserStorage.php +++ b/src/lib/FieldType/User/UserStorage.php @@ -35,26 +35,24 @@ class UserStorage extends GatewayBasedStorage */ protected $gateway; - public function storeFieldData(VersionInfo $versionInfo, Field $field, array $context) + public function storeFieldData(VersionInfo $versionInfo, Field $field) { return $this->gateway->storeFieldData($versionInfo, $field); } - public function getFieldData(VersionInfo $versionInfo, Field $field, array $context) + public function getFieldData(VersionInfo $versionInfo, Field $field) { $field->value->externalData = $this->gateway->getFieldData($field->id); } /** - * @param \Ibexa\Contracts\Core\Persistence\Content\VersionInfo $versionInfo * @param int[] $fieldIds Array of field Ids - * @param array $context * * @return bool * * @throws \Doctrine\DBAL\DBALException */ - public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array $context) + public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds) { return $this->gateway->deleteFieldData($versionInfo, $fieldIds); } @@ -69,11 +67,6 @@ public function hasFieldData(): bool return true; } - public function getIndexData(VersionInfo $versionInfo, Field $field, array $context): array - { - return []; - } - /** * @param int[] $supportedHashTypes */ diff --git a/src/lib/Helper/PreviewLocationProvider.php b/src/lib/Helper/PreviewLocationProvider.php index 1e96f65a6c..4da6a3642e 100644 --- a/src/lib/Helper/PreviewLocationProvider.php +++ b/src/lib/Helper/PreviewLocationProvider.php @@ -8,7 +8,6 @@ namespace Ibexa\Core\Helper; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as PersistenceLocationHandler; -use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Values\Content\Content as APIContent; use Ibexa\Contracts\Core\Repository\Values\Content\Location as APILocation; @@ -22,52 +21,21 @@ class PreviewLocationProvider /** @var \Ibexa\Contracts\Core\Repository\LocationService */ private $locationService; - /** @var \Ibexa\Contracts\Core\Repository\ContentService */ - private $contentService; - /** @var \Ibexa\Contracts\Core\Persistence\Content\Location\Handler */ private $locationHandler; /** * @param \Ibexa\Contracts\Core\Repository\LocationService $locationService - * @param \Ibexa\Contracts\Core\Repository\ContentService $contentService * @param \Ibexa\Contracts\Core\Persistence\Content\Location\Handler $locationHandler */ public function __construct( LocationService $locationService, - ContentService $contentService, PersistenceLocationHandler $locationHandler ) { $this->locationService = $locationService; - $this->contentService = $contentService; $this->locationHandler = $locationHandler; } - /** - * Loads the main location for $contentId. - * - * If the content does not have a location (yet), but has a Location draft, it is returned instead. - * Location drafts do not have an id (it is set to null), and can be tested using the isDraft() method. - * - * If the content doesn't have a location nor a location draft, null is returned. - * - * @deprecated Since 7.5.4, rather use loadMainLocationByContent. - * @see loadMainLocationByContent - * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\NotFoundException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * - * @param mixed $contentId - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location|null - */ - public function loadMainLocation($contentId) - { - return $this->loadMainLocationByContent( - $this->contentService->loadContent($contentId) - ); - } - /** * Loads the main location for $content. * diff --git a/src/lib/IO/ConfigScopeChangeAwareIOService.php b/src/lib/IO/ConfigScopeChangeAwareIOService.php index 8f35446630..1af4d53e6b 100644 --- a/src/lib/IO/ConfigScopeChangeAwareIOService.php +++ b/src/lib/IO/ConfigScopeChangeAwareIOService.php @@ -43,11 +43,6 @@ public function setPrefix($prefix): void $this->innerIOService->setPrefix($prefix); } - public function getExternalPath($internalId): string - { - return $this->innerIOService->getExternalPath($internalId); - } - public function newBinaryCreateStructFromLocalFile($localFile): BinaryFileCreateStruct { return $this->innerIOService->newBinaryCreateStructFromLocalFile($localFile); @@ -58,11 +53,6 @@ public function exists($binaryFileId): bool return $this->innerIOService->exists($binaryFileId); } - public function getInternalPath($externalId): string - { - return $this->innerIOService->getInternalPath($externalId); - } - public function loadBinaryFile($binaryFileId): BinaryFile { return $this->innerIOService->loadBinaryFile($binaryFileId); diff --git a/src/lib/IO/IOMetadataHandler/LegacyDFSCluster.php b/src/lib/IO/IOMetadataHandler/LegacyDFSCluster.php index d78210a039..79cc6dd02f 100644 --- a/src/lib/IO/IOMetadataHandler/LegacyDFSCluster.php +++ b/src/lib/IO/IOMetadataHandler/LegacyDFSCluster.php @@ -43,30 +43,30 @@ public function __construct(Connection $connection, UrlDecorator $urlDecorator = /** * Inserts a new reference to file $spiBinaryFileId. * - * @since 6.10 The mtime of the $binaryFileCreateStruct must be a DateTime, as specified in the struct doc. + * @param \Ibexa\Contracts\Core\IO\BinaryFileCreateStruct $spiBinaryFileCreateStruct * - * @param \Ibexa\Contracts\Core\IO\BinaryFileCreateStruct $binaryFileCreateStruct + * @return \Ibexa\Contracts\Core\IO\BinaryFile * + *@throws \RuntimeException if a DBAL error occurs * @throws \Ibexa\Core\Base\Exceptions\InvalidArgumentException if the $binaryFileCreateStruct is invalid - * @throws \RuntimeException if a DBAL error occurs * - * @return \Ibexa\Contracts\Core\IO\BinaryFile + * @since 6.10 The mtime of the $binaryFileCreateStruct must be a DateTime, as specified in the struct doc. */ - public function create(SPIBinaryFileCreateStruct $binaryFileCreateStruct) + public function create(SPIBinaryFileCreateStruct $spiBinaryFileCreateStruct) { - if (!($binaryFileCreateStruct->mtime instanceof DateTime)) { + if (!($spiBinaryFileCreateStruct->mtime instanceof DateTime)) { throw new InvalidArgumentException('$binaryFileCreateStruct', 'Property \'mtime\' must be a DateTime'); } - $path = (string)$this->addPrefix($binaryFileCreateStruct->id); + $path = (string)$this->addPrefix($spiBinaryFileCreateStruct->id); $params = [ 'name' => $path, 'name_hash' => md5($path), - 'name_trunk' => $this->getNameTrunk($binaryFileCreateStruct), - 'mtime' => $binaryFileCreateStruct->mtime->getTimestamp(), - 'size' => $binaryFileCreateStruct->size, - 'scope' => $this->getScope($binaryFileCreateStruct), - 'datatype' => $binaryFileCreateStruct->mimeType, + 'name_trunk' => $this->getNameTrunk($spiBinaryFileCreateStruct), + 'mtime' => $spiBinaryFileCreateStruct->mtime->getTimestamp(), + 'size' => $spiBinaryFileCreateStruct->size, + 'scope' => $this->getScope($spiBinaryFileCreateStruct), + 'datatype' => $spiBinaryFileCreateStruct->mimeType, ]; try { @@ -82,7 +82,7 @@ public function create(SPIBinaryFileCreateStruct $binaryFileCreateStruct) ]); } - return $this->mapSPIBinaryFileCreateStructToSPIBinaryFile($binaryFileCreateStruct); + return $this->mapSPIBinaryFileCreateStructToSPIBinaryFile($spiBinaryFileCreateStruct); } /** @@ -304,7 +304,6 @@ protected function mapArrayToSPIBinaryFile(array $properties) $spiBinaryFile->id = $properties['id']; $spiBinaryFile->size = $properties['size']; $spiBinaryFile->mtime = new DateTime('@' . $properties['mtime']); - $spiBinaryFile->mimeType = $properties['datatype']; return $spiBinaryFile; } @@ -320,7 +319,6 @@ protected function mapSPIBinaryFileCreateStructToSPIBinaryFile(SPIBinaryFileCrea $spiBinaryFile->id = $binaryFileCreateStruct->id; $spiBinaryFile->mtime = $binaryFileCreateStruct->mtime; $spiBinaryFile->size = $binaryFileCreateStruct->size; - $spiBinaryFile->mimeType = $binaryFileCreateStruct->mimeType; return $spiBinaryFile; } diff --git a/src/lib/IO/IOService.php b/src/lib/IO/IOService.php index 468c200eaa..57087e789b 100644 --- a/src/lib/IO/IOService.php +++ b/src/lib/IO/IOService.php @@ -197,16 +197,6 @@ public function getFileContents(BinaryFile $binaryFile) ); } - public function getInternalPath($binaryFileId) - { - return $this->binarydataHandler->getUri($this->getPrefixedUri($binaryFileId)); - } - - public function getExternalPath($internalId) - { - return $this->loadBinaryFileByUri($internalId)->id; - } - public function getUri($binaryFileId) { return $this->binarydataHandler->getUri($binaryFileId); @@ -257,7 +247,6 @@ protected function buildDomainBinaryFileObject(SPIBinaryFile $spiBinaryFile) 'mtime' => $spiBinaryFile->mtime, 'id' => $this->removeUriPrefix($spiBinaryFile->id), 'uri' => $spiBinaryFile->uri, - 'mimeType' => $spiBinaryFile->mimeType ?: $this->metadataHandler->getMimeType($spiBinaryFile->id), ] ); } diff --git a/src/lib/IO/IOServiceInterface.php b/src/lib/IO/IOServiceInterface.php index affd036b95..0ad678c523 100644 --- a/src/lib/IO/IOServiceInterface.php +++ b/src/lib/IO/IOServiceInterface.php @@ -22,17 +22,6 @@ interface IOServiceInterface */ public function setPrefix($prefix); - /** - * Returns the external path to $internalPath. - * - * @param string $internalId - * - * @deprecated Since 5.4. Use loadBinaryFileByUri. - * - * @return string - */ - public function getExternalPath($internalId); - /** * Creates a BinaryFileCreateStruct object from $localFile. * @@ -53,17 +42,6 @@ public function newBinaryCreateStructFromLocalFile($localFile); */ public function exists($binaryFileId); - /** - * Returns the internal, handler level path to $externalPath. - * - * @param string $externalId - * - * @deprecated Since 5.4. Use the uri property. - * - * @return string - */ - public function getInternalPath($externalId); - /** * Loads the binary file with $id. * diff --git a/src/lib/IO/MetadataHandler.php b/src/lib/IO/MetadataHandler.php deleted file mode 100644 index 453fc56198..0000000000 --- a/src/lib/IO/MetadataHandler.php +++ /dev/null @@ -1,23 +0,0 @@ - $metadata[0], - 'height' => $metadata[1], - // required until a dedicated mimetype metadata handler is added - 'mime' => $metadata['mime'], - ]; - } -} diff --git a/src/lib/IO/Values/BinaryFile.php b/src/lib/IO/Values/BinaryFile.php index 20033a617e..e698fd4cd6 100644 --- a/src/lib/IO/Values/BinaryFile.php +++ b/src/lib/IO/Values/BinaryFile.php @@ -49,15 +49,4 @@ class BinaryFile extends ValueObject * @var string */ protected $uri; - - /** - * The file's mime type. - * - * Example: text/xml - * - * @deprecated Since 5.3.3, use IOService::getMimeType() if you want to be 6.0 compatible as opposed to < 5.3.3 - * - * @var string - */ - public $mimeType; } diff --git a/src/lib/MVC/Symfony/Component/Serializer/RegexHostNormalizer.php b/src/lib/MVC/Symfony/Component/Serializer/RegexHostNormalizer.php deleted file mode 100644 index 2aaa3128c2..0000000000 --- a/src/lib/MVC/Symfony/Component/Serializer/RegexHostNormalizer.php +++ /dev/null @@ -1,24 +0,0 @@ -, - * languages: string[], - * headers: array{} + * scheme: ?string, + * host: ?string, + * port: ?int, + * pathinfo: ?string, + * queryParams: ?array, + * languages: ?string[], + * headers: ?array{} * } * * @see \Symfony\Component\Serializer\Normalizer\NormalizerInterface::normalize @@ -30,12 +30,12 @@ final class SimplifiedRequestNormalizer extends PropertyNormalizer public function normalize($object, $format = null, array $context = []): array { return [ - 'scheme' => $object->scheme, - 'host' => $object->host, - 'port' => $object->port, - 'pathinfo' => $object->pathinfo, - 'queryParams' => $object->queryParams, - 'languages' => $object->languages, + 'scheme' => $object->getScheme(), + 'host' => $object->getHost(), + 'port' => $object->getPort(), + 'pathinfo' => $object->getPathInfo(), + 'queryParams' => $object->getQueryParams(), + 'languages' => $object->getLanguages(), 'headers' => [], ]; } diff --git a/src/lib/MVC/Symfony/Event/ContentCacheClearEvent.php b/src/lib/MVC/Symfony/Event/ContentCacheClearEvent.php deleted file mode 100644 index d61db02b73..0000000000 --- a/src/lib/MVC/Symfony/Event/ContentCacheClearEvent.php +++ /dev/null @@ -1,72 +0,0 @@ -contentInfo = $contentInfo; - } - - /** - * Returns ContentInfo object we're clearing the cache for. - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo - */ - public function getContentInfo() - { - return $this->contentInfo; - } - - /** - * Returns all location objects registered to the cache clear process. - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\Location[] - */ - public function getLocationsToClear() - { - return $this->locationsToClear; - } - - /** - * Adds a location that needs to be cleared. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location $location - */ - public function addLocationToClear(Location $location) - { - $this->locationsToClear[] = $location; - } - - /** - * Replaces the list of locations to clear. - * - * @param \Ibexa\Contracts\Core\Repository\Values\Content\Location[] $locationsToClear - */ - public function setLocationsToClear(array $locationsToClear) - { - $this->locationsToClear = $locationsToClear; - } -} diff --git a/src/lib/MVC/Symfony/EventListener/SiteAccessMatchListener.php b/src/lib/MVC/Symfony/EventListener/SiteAccessMatchListener.php index 711df116a8..c172971cfe 100644 --- a/src/lib/MVC/Symfony/EventListener/SiteAccessMatchListener.php +++ b/src/lib/MVC/Symfony/EventListener/SiteAccessMatchListener.php @@ -101,15 +101,13 @@ private function getSiteAccessFromRequest(Request $request) { return $this->siteAccessRouter->match( new SimplifiedRequest( - [ - 'scheme' => $request->getScheme(), - 'host' => $request->getHost(), - 'port' => $request->getPort(), - 'pathinfo' => $request->getPathInfo(), - 'queryParams' => $request->query->all(), - 'languages' => $request->getLanguages(), - 'headers' => $request->headers->all(), - ] + $request->getScheme(), + $request->getHost(), + $request->getPort(), + $request->getPathInfo(), + $request->query->all(), + $request->getLanguages(), + $request->headers->all() ) ); } diff --git a/src/lib/MVC/Symfony/FieldType/BinaryBase/ContentDownloadUrlGenerator.php b/src/lib/MVC/Symfony/FieldType/BinaryBase/ContentDownloadUrlGenerator.php index 15bb27430c..e067fb62b2 100644 --- a/src/lib/MVC/Symfony/FieldType/BinaryBase/ContentDownloadUrlGenerator.php +++ b/src/lib/MVC/Symfony/FieldType/BinaryBase/ContentDownloadUrlGenerator.php @@ -7,13 +7,12 @@ namespace Ibexa\Core\MVC\Symfony\FieldType\BinaryBase; -use Ibexa\Contracts\Core\FieldType\BinaryBase\PathGenerator; use Ibexa\Contracts\Core\FieldType\BinaryBase\RouteAwarePathGenerator; use Ibexa\Contracts\Core\Persistence\Content\Field; use Ibexa\Contracts\Core\Persistence\Content\VersionInfo; use Symfony\Component\Routing\RouterInterface; -class ContentDownloadUrlGenerator extends PathGenerator implements RouteAwarePathGenerator +class ContentDownloadUrlGenerator implements RouteAwarePathGenerator { /** @var \Symfony\Component\Routing\RouterInterface */ private $router; diff --git a/src/lib/MVC/Symfony/Locale/LocaleConverter.php b/src/lib/MVC/Symfony/Locale/LocaleConverter.php index 8d0c9fe3cd..010478b89a 100644 --- a/src/lib/MVC/Symfony/Locale/LocaleConverter.php +++ b/src/lib/MVC/Symfony/Locale/LocaleConverter.php @@ -55,25 +55,6 @@ public function convertToPOSIX($ezpLocale) return $this->conversionMap[$ezpLocale]; } - /** - * Converts a locale in POSIX format to Ibexa internal format. - * Returns null if conversion cannot be made. - * - * @param string $posixLocale - * - * @return string|null - */ - public function convertToEz($posixLocale) - { - if (!isset($this->reverseConversionMap[$posixLocale])) { - $this->logger->warning("Could not convert locale '$posixLocale' to Ibexa format. Please check your locale configuration in ezplatform.yml"); - - return; - } - - return $this->reverseConversionMap[$posixLocale]; - } - public function convertToRepository(string $posixLocale): ?string { if (!isset($this->reverseConversionMap[$posixLocale])) { diff --git a/src/lib/MVC/Symfony/Locale/LocaleConverterInterface.php b/src/lib/MVC/Symfony/Locale/LocaleConverterInterface.php index a1e8c34f5e..5258f34f15 100644 --- a/src/lib/MVC/Symfony/Locale/LocaleConverterInterface.php +++ b/src/lib/MVC/Symfony/Locale/LocaleConverterInterface.php @@ -26,18 +26,6 @@ interface LocaleConverterInterface */ public function convertToPOSIX($ezpLocale); - /** - * Converts a locale in POSIX format to Ibexa internal format. - * Returns null if conversion cannot be made. - * - * @deprecated 4.5.2 To be removed in 5.0. Use {@see convertToRepository()} instead. - * - * @param string $posixLocale - * - * @return string|null - */ - public function convertToEz($posixLocale); - /** * Converts a locale in POSIX format to Repository internal format. * Returns null if conversion cannot be made. diff --git a/src/lib/MVC/Symfony/MVCEvents.php b/src/lib/MVC/Symfony/MVCEvents.php index 7b92f632ae..5876106b30 100644 --- a/src/lib/MVC/Symfony/MVCEvents.php +++ b/src/lib/MVC/Symfony/MVCEvents.php @@ -58,14 +58,4 @@ final class MVCEvents * The event listener method receives a {@see \Ibexa\Core\MVC\Symfony\Event\RouteReferenceGenerationEvent} instance. */ public const ROUTE_REFERENCE_GENERATION = 'ezpublish.routing.reference_generation'; - - /** - * CACHE_CLEAR_CONTENT event occurs when cache needs to be cleared for a content. - * It gives the opportunity to add related locations to clear (aka "smart cache clearing"). - * - * The event listener method receives a {@see \Ibexa\Core\MVC\Symfony\Event\ContentCacheClearEvent} instance. - * - * @deprecated Since 6.12, not triggered anymore when using ezplatform-http-cache package. - */ - public const CACHE_CLEAR_CONTENT = 'ezpublish.cache_clear.content'; } diff --git a/src/lib/MVC/Symfony/Routing/Generator.php b/src/lib/MVC/Symfony/Routing/Generator.php index 3605d7c9f7..a559547d6c 100644 --- a/src/lib/MVC/Symfony/Routing/Generator.php +++ b/src/lib/MVC/Symfony/Routing/Generator.php @@ -147,27 +147,27 @@ protected function generateAbsoluteUrl($uri, RequestContext $requestContext) private function getContextBySimplifiedRequest(SimplifiedRequest $simplifiedRequest) { $context = clone $this->requestContext; - if ($simplifiedRequest->scheme) { - $context->setScheme($simplifiedRequest->scheme); + if ($simplifiedRequest->getScheme()) { + $context->setScheme($simplifiedRequest->getScheme()); } - if ($simplifiedRequest->port) { - switch ($simplifiedRequest->scheme) { + if ($simplifiedRequest->getPort()) { + switch ($simplifiedRequest->getScheme()) { case 'https': - $context->setHttpsPort($simplifiedRequest->port); + $context->setHttpsPort($simplifiedRequest->getPort()); break; default: - $context->setHttpPort($simplifiedRequest->port); + $context->setHttpPort($simplifiedRequest->getPort()); break; } } - if ($simplifiedRequest->host) { - $context->setHost($simplifiedRequest->host); + if ($simplifiedRequest->getHost()) { + $context->setHost($simplifiedRequest->getHost()); } - if ($simplifiedRequest->pathinfo) { - $context->setPathInfo($simplifiedRequest->pathinfo); + if ($simplifiedRequest->getPathInfo()) { + $context->setPathInfo($simplifiedRequest->getPathInfo()); } return $context; diff --git a/src/lib/MVC/Symfony/Routing/SimplifiedRequest.php b/src/lib/MVC/Symfony/Routing/SimplifiedRequest.php index 933e4e7901..ee1dfb539f 100644 --- a/src/lib/MVC/Symfony/Routing/SimplifiedRequest.php +++ b/src/lib/MVC/Symfony/Routing/SimplifiedRequest.php @@ -9,67 +9,79 @@ use Ibexa\Contracts\Core\Repository\Values\ValueObject; -/** - * @property-read string $scheme @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see SimplifiedRequest::getScheme()} instead. - * @property-read string $host @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see SimplifiedRequest::getHost()} instead. - * @property-read string $port @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see SimplifiedRequest::getPort()} instead. - * @property-read string $pathinfo @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see SimplifiedRequest::getPathInfo()} instead. - * @property-read array $queryParams @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see SimplifiedRequest::getQueryParams()} instead. - * @property-read array $languages @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see SimplifiedRequest::getLanguages()} instead. - * @property-read array $headers @deprecated 4.6.7 accessing magic getter is deprecated and will be removed in 5.0.0. Use {@see SimplifiedRequest::getHeaders()} instead. - */ class SimplifiedRequest extends ValueObject { /** * The request scheme (http or https). - * - * @var string */ - protected $scheme; + protected ?string $scheme = null; /** * The host name. - * - * @var string */ - protected $host; + protected ?string $host = null; /** * The port the request is made on. - * - * @var string */ - protected $port; + protected ?int $port = null; /** * The path being requested relative to the executed script. * The path info always starts with a /. - * - * @var string */ - protected $pathinfo; + protected ?string $pathinfo = null; /** * Array of parameters extracted from the query string. * - * @var array + * @var array|null */ - protected $queryParams; + protected ?array $queryParams = null; /** * List of languages acceptable by the client browser. * The languages are ordered in the user browser preferences. * - * @var array + * @var string[]|null */ - protected $languages; + protected ?array $languages = null; /** * Hash of request headers. * - * @var array - */ - protected $headers; + * @var array>|null + */ + protected ?array $headers = null; + + public function __construct( + //string $scheme = 'http', string $host = '', int $port = 80, string $pathinfo = '', array $queryParams = [], array $languages = [], array $headers = [] + ) { + $args = func_get_args(); + + if ( + empty($args) || + (func_num_args() === 1 && is_array($args[0])) + ) { + if (!empty($args)) { + trigger_deprecation( + 'ibexa/core', + '5.0', + 'The signature of method "%s()" now requires explicit arguments: "string $scheme, string $host, string $port, string $pathinfo, array $queryParams, array $languages, array $headers", using ValueObject array constructor is deprecated.', + __METHOD__ + ); + } + parent::__construct($args[0] ?? []); + } else { + $this->scheme = $args[0] ?? null; + $this->host = $args[1] ?? null; + $this->port = isset($args[2]) ? (int)$args[2] : null; + $this->pathinfo = $args[3] ?? null; + $this->queryParams = $args[4] ?? null; + $this->languages = $args[5] ?? null; + $this->headers = $args[6] ?? null; + } + } /** * @param array $headers @@ -104,7 +116,7 @@ public function setPathinfo($pathinfo) } /** - * @param string $port + * @param int $port */ public function setPort($port) { @@ -149,7 +161,15 @@ public static function fromUrl($url) // Remove unwanted keys returned by parse_url() so that we don't have them as properties. unset($elements['path'], $elements['query'], $elements['user'], $elements['pass'], $elements['fragment']); - return new static($elements); + return new static( + $elements['scheme'] ?? null, + $elements['host'] ?? null, + $elements['port'] ?? null, + $elements['pathinfo'] ?? null, + $elements['queryParams'] ?? null, + $elements['languages'] ?? null, + $elements['headers'] ?? null, + ); } public function __sleep() @@ -163,17 +183,17 @@ public function __sleep() /** * The request scheme - http or https. */ - public function getScheme(): string + public function getScheme(): ?string { return $this->scheme; } - public function getHost(): string + public function getHost(): ?string { return $this->host; } - public function getPort(): string + public function getPort(): ?int { return $this->port; } @@ -181,23 +201,23 @@ public function getPort(): string /** * The path being requested relative to the executed script. */ - public function getPathInfo(): string + public function getPathInfo(): ?string { return $this->pathinfo; } /** - * @return array + * @return array|null */ - public function getQueryParams(): array + public function getQueryParams(): ?array { return $this->queryParams; } /** - * @return string[] + * @return string[]|null */ - public function getLanguages(): array + public function getLanguages(): ?array { return $this->languages; } @@ -211,9 +231,9 @@ public function getHeader(string $headerName): ?array } /** - * @return array> + * @return array>|null */ - public function getHeaders(): array + public function getHeaders(): ?array { return $this->headers; } diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/HostElement.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/HostElement.php index 0554c20a80..dba77ecc6e 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/HostElement.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/HostElement.php @@ -83,7 +83,7 @@ public function getRequest() public function reverseMatch($siteAccessName) { - $hostElements = explode('.', $this->request->host); + $hostElements = explode('.', (string)$this->request->getHost()); $elementNumber = $this->elementNumber - 1; if (!isset($hostElements[$elementNumber])) { return null; @@ -106,7 +106,7 @@ private function getHostElements() return []; } - $elements = explode('.', $this->request->host); + $elements = explode('.', $this->request->getHost()); return $this->hostElements = $elements; } diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/HostText.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/HostText.php index 890063c3aa..d169a9801e 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/HostText.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/HostText.php @@ -30,7 +30,7 @@ public function getName(): string public function setRequest(SimplifiedRequest $request): void { if (!$this->element) { - $this->setMatchElement($request->host); + $this->setMatchElement((string)$request->getHost()); } parent::setRequest($request); diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Host.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Host.php index a04ef3967c..b629c409d5 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Host.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Host.php @@ -25,7 +25,7 @@ public function getName(): string public function setRequest(SimplifiedRequest $request) { if (!$this->key) { - $this->setMapKey($request->host); + $this->setMapKey((string)$request->getHost()); } parent::setRequest($request); diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Port.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Port.php index 1c7083f7fe..75f6d0d0d3 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Port.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/Port.php @@ -25,10 +25,10 @@ public function getName(): string public function setRequest(SimplifiedRequest $request) { if (!$this->key) { - if (!empty($request->port)) { - $key = $request->port; + if (!empty($request->getPort())) { + $key = $request->getPort(); } else { - switch ($request->scheme) { + switch ($request->getScheme()) { case 'https': $key = 443; break; @@ -39,7 +39,7 @@ public function setRequest(SimplifiedRequest $request) } } - $this->setMapKey($key); + $this->setMapKey((string)$key); } parent::setRequest($request); @@ -49,7 +49,7 @@ public function reverseMatch($siteAccessName) { $matcher = parent::reverseMatch($siteAccessName); if ($matcher instanceof self) { - $matcher->getRequest()->setPort($matcher->getMapKey()); + $matcher->getRequest()->setPort((int)$matcher->getMapKey()); } return $matcher; diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/URI.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/URI.php index c4aa6c2bca..a940b8bb8c 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/URI.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/Map/URI.php @@ -21,7 +21,7 @@ class URI extends Map implements URILexer public function setRequest(SimplifiedRequest $request) { if (!$this->key) { - sscanf($request->pathinfo, '/%[^/]', $key); + sscanf((string)$request->getPathInfo(), '/%[^/]', $key); $this->setMapKey(rawurldecode((string)$key)); } @@ -82,7 +82,7 @@ public function reverseMatch($siteAccessName) if ($matcher instanceof self) { $request = $matcher->getRequest(); // Clean up "old" siteaccess prefix and add the new prefix. - $request->setPathinfo($this->analyseLink($request->pathinfo)); + $request->setPathinfo($this->analyseLink((string)$request->getPathInfo())); } return $matcher; diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/Host.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/Host.php deleted file mode 100644 index 78a7bdf2ef..0000000000 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/Host.php +++ /dev/null @@ -1,58 +0,0 @@ -siteAccessesConfiguration = $siteAccessesConfiguration; - } - - public function getName(): string - { - return 'host:regexp'; - } - - /** - * Injects the request object to match against. - * - * @param \Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest $request - */ - public function setRequest(SimplifiedRequest $request) - { - if (!$this->element) { - $this->setMatchElement($request->host); - } - - parent::setRequest($request); - } -} diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/URI.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/URI.php deleted file mode 100644 index 9d49eeb30c..0000000000 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/Regex/URI.php +++ /dev/null @@ -1,58 +0,0 @@ -siteAccessesConfiguration = $siteAccessesConfiguration; - } - - public function getName(): string - { - return 'uri:regexp'; - } - - /** - * Injects the request object to match against. - * - * @param \Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest $request - */ - public function setRequest(SimplifiedRequest $request) - { - if (!$this->element) { - $this->setMatchElement($request->pathinfo); - } - - parent::setRequest($request); - } -} diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/URIElement.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/URIElement.php index 11c5dcd8ec..49dddd748a 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/URIElement.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/URIElement.php @@ -81,7 +81,7 @@ protected function getURIElements() } $elements = array_slice( - explode('/', $this->request->pathinfo), + explode('/', $this->request->getPathInfo()), 1, $this->elementNumber ); @@ -178,7 +178,7 @@ public function reverseMatch($siteAccessName) return null; } - $pathinfo = '/' . implode('/', $elements) . '/' . ltrim($this->request->pathinfo, '/'); + $pathinfo = '/' . implode('/', $elements) . '/' . ltrim((string)$this->request->getPathInfo(), '/'); $this->request->setPathinfo($pathinfo); return $this; diff --git a/src/lib/MVC/Symfony/SiteAccess/Matcher/URIText.php b/src/lib/MVC/Symfony/SiteAccess/Matcher/URIText.php index ff2016298e..eeef01066e 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Matcher/URIText.php +++ b/src/lib/MVC/Symfony/SiteAccess/Matcher/URIText.php @@ -31,7 +31,7 @@ public function getName(): string public function setRequest(SimplifiedRequest $request): void { if (!$this->element) { - $this->setMatchElement($request->pathinfo); + $this->setMatchElement((string)$request->getPathInfo()); } parent::setRequest($request); @@ -54,7 +54,7 @@ public function analyseLink($linkUri): string public function reverseMatch($siteAccessName): ?VersatileMatcher { - $this->request->setPathinfo("/{$this->prefix}{$siteAccessName}{$this->suffix}{$this->request->pathinfo}"); + $this->request->setPathinfo("/{$this->prefix}{$siteAccessName}{$this->suffix}{$this->request->getPathInfo()}"); return $this; } diff --git a/src/lib/MVC/Symfony/SiteAccess/Router.php b/src/lib/MVC/Symfony/SiteAccess/Router.php index 7470697f15..5242945875 100644 --- a/src/lib/MVC/Symfony/SiteAccess/Router.php +++ b/src/lib/MVC/Symfony/SiteAccess/Router.php @@ -222,7 +222,7 @@ public function matchByName($siteAccessName): ?SiteAccess $request = clone $this->request; // Be sure to have a clean pathinfo, without SiteAccess part in it. if ($this->siteAccess && $this->siteAccess->matcher instanceof URILexer) { - $request->setPathinfo($this->siteAccess->matcher->analyseURI($request->pathinfo)); + $request->setPathinfo($this->siteAccess->matcher->analyseURI((string)$request->getPathInfo())); } $siteAccessClass = $this->siteAccessClass; diff --git a/src/lib/MVC/Symfony/Templating/Twig/Extension/CoreExtension.php b/src/lib/MVC/Symfony/Templating/Twig/Extension/CoreExtension.php index 7ca88d03ac..973c3f6dff 100644 --- a/src/lib/MVC/Symfony/Templating/Twig/Extension/CoreExtension.php +++ b/src/lib/MVC/Symfony/Templating/Twig/Extension/CoreExtension.php @@ -27,8 +27,6 @@ public function __construct(GlobalHelper $globalHelper) public function getGlobals(): array { return [ - /** @deprecated ezplatform is deprecated since 4.0, use ibexa instead */ - 'ezplatform' => $this->globalHelper, 'ibexa' => $this->globalHelper, ]; } diff --git a/src/lib/MVC/Symfony/View/Manager.php b/src/lib/MVC/Symfony/View/Manager.php index 21b051c20f..b709740c2c 100644 --- a/src/lib/MVC/Symfony/View/Manager.php +++ b/src/lib/MVC/Symfony/View/Manager.php @@ -26,26 +26,6 @@ class Manager implements ViewManagerInterface /** @var \Psr\Log\LoggerInterface */ protected $logger; - /** - * @var array Array indexed by priority. - * Each priority key is an array of Content View Provider objects having this priority. - * The highest priority number is the highest priority - */ - protected $contentViewProviders = []; - - /** - * @var array Array indexed by priority. - * Each priority key is an array of Location View Provider objects having this priority. - * The highest priority number is the highest priority - */ - protected $locationViewProviders = []; - - /** @var \Ibexa\Core\MVC\Symfony\View\Provider\Content[] */ - protected $sortedContentViewProviders; - - /** @var \Ibexa\Core\MVC\Symfony\View\Provider\Location[] */ - protected $sortedLocationViewProviders; - /** @var \Ibexa\Contracts\Core\Repository\Repository */ protected $repository; @@ -84,91 +64,6 @@ public function __construct( $this->viewConfigurator = $viewConfigurator; } - /** - * Helper for {@see addContentViewProvider()} and {@see addLocationViewProvider()}. - * - * @param array $property - * @param \Ibexa\Core\MVC\Symfony\View\ViewProvider $viewProvider - * @param int $priority - */ - private function addViewProvider(&$property, $viewProvider, $priority) - { - $priority = (int)$priority; - if (!isset($property[$priority])) { - $property[$priority] = []; - } - - $property[$priority][] = $viewProvider; - } - - /** - * Registers $viewProvider as a valid content view provider. - * When this view provider will be called in the chain depends on $priority. The highest $priority is, the earliest the router will be called. - * - * @param \Ibexa\Core\MVC\Symfony\View\ViewProvider $viewProvider - * @param int $priority - */ - public function addContentViewProvider(ViewProvider $viewProvider, $priority = 0) - { - $this->addViewProvider($this->contentViewProviders, $viewProvider, $priority); - } - - /** - * Registers $viewProvider as a valid location view provider. - * When this view provider will be called in the chain depends on $priority. The highest $priority is, the earliest the router will be called. - * - * @param \Ibexa\Core\MVC\Symfony\View\ViewProvider $viewProvider - * @param int $priority - */ - public function addLocationViewProvider(ViewProvider $viewProvider, $priority = 0) - { - $this->addViewProvider($this->locationViewProviders, $viewProvider, $priority); - } - - /** - * @return \Ibexa\Core\MVC\Symfony\View\ViewProvider[] - */ - public function getAllContentViewProviders() - { - if (empty($this->sortedContentViewProviders)) { - $this->sortedContentViewProviders = $this->sortViewProviders($this->contentViewProviders); - } - - return $this->sortedContentViewProviders; - } - - /** - * @return \Ibexa\Core\MVC\Symfony\View\ViewProvider[] - */ - public function getAllLocationViewProviders() - { - if (empty($this->sortedLocationViewProviders)) { - $this->sortedLocationViewProviders = $this->sortViewProviders($this->locationViewProviders); - } - - return $this->sortedLocationViewProviders; - } - - /** - * Sort the registered view providers by priority. - * The highest priority number is the highest priority (reverse sorting). - * - * @param array $property view providers to sort - * - * @return \Ibexa\Core\MVC\Symfony\View\Provider\Content[]|\Ibexa\Core\MVC\Symfony\View\Provider\Location[] - */ - protected function sortViewProviders($property) - { - $sortedViewProviders = []; - krsort($property); - - foreach ($property as $viewProvider) { - $sortedViewProviders = array_merge($sortedViewProviders, $viewProvider); - } - - return $sortedViewProviders; - } - /** * Renders $content by selecting the right template. * $content will be injected in the selected template. diff --git a/src/lib/MVC/Symfony/View/ParametersInjector/ViewbaseLayout.php b/src/lib/MVC/Symfony/View/ParametersInjector/ViewbaseLayout.php index 0548cb4572..715f26c870 100644 --- a/src/lib/MVC/Symfony/View/ParametersInjector/ViewbaseLayout.php +++ b/src/lib/MVC/Symfony/View/ParametersInjector/ViewbaseLayout.php @@ -44,8 +44,6 @@ public function injectViewbaseLayout(FilterViewParametersEvent $event) $pageLayout = $this->getPageLayout(); $event->getParameterBag()->set('view_base_layout', $this->viewbaseLayout); - // @deprecated since 8.0. Use `page_layout` instead - $event->getParameterBag()->set('pagelayout', $pageLayout); $event->getParameterBag()->set('page_layout', $pageLayout); } } diff --git a/src/lib/MVC/Symfony/View/Provider/Content.php b/src/lib/MVC/Symfony/View/Provider/Content.php deleted file mode 100644 index 6e534fc4cc..0000000000 --- a/src/lib/MVC/Symfony/View/Provider/Content.php +++ /dev/null @@ -1,30 +0,0 @@ -storeFieldData( $content->versionInfo, $field, - [] ); if ($result === true) { @@ -129,8 +128,7 @@ public function persistExternalStorageField(ResolveMissingFieldEvent $event): vo $storage->getFieldData( $content->versionInfo, - $field, - [] + $field ); $event->setField($field); diff --git a/src/lib/Persistence/Legacy/Content/StorageHandler.php b/src/lib/Persistence/Legacy/Content/StorageHandler.php index 5ef0253265..034773a455 100644 --- a/src/lib/Persistence/Legacy/Content/StorageHandler.php +++ b/src/lib/Persistence/Legacy/Content/StorageHandler.php @@ -51,8 +51,7 @@ public function storeFieldData(VersionInfo $versionInfo, Field $field) { return $this->storageRegistry->getStorage($field->type)->storeFieldData( $versionInfo, - $field, - $this->context + $field ); } @@ -66,8 +65,7 @@ public function copyFieldData(VersionInfo $versionInfo, Field $field, Field $ori return $this->storageRegistry->getStorage($field->type)->copyLegacyField( $versionInfo, $field, - $originalField, - $this->context + $originalField ); } @@ -81,7 +79,7 @@ public function getFieldData(VersionInfo $versionInfo, Field $field) { $storage = $this->storageRegistry->getStorage($field->type); if ($field->id !== null && $storage->hasFieldData()) { - $storage->getFieldData($versionInfo, $field, $this->context); + $storage->getFieldData($versionInfo, $field); } } @@ -95,6 +93,6 @@ public function getFieldData(VersionInfo $versionInfo, Field $field) public function deleteFieldData($fieldType, VersionInfo $versionInfo, array $ids) { $this->storageRegistry->getStorage($fieldType) - ->deleteFieldData($versionInfo, $ids, $this->context); + ->deleteFieldData($versionInfo, $ids); } } diff --git a/src/lib/Repository/ContentService.php b/src/lib/Repository/ContentService.php index 4c8cee3ab3..f8ce15a912 100644 --- a/src/lib/Repository/ContentService.php +++ b/src/lib/Repository/ContentService.php @@ -1163,43 +1163,6 @@ public function countContentDrafts(?User $user = null): int ); } - /** - * Loads drafts for a user. - * - * If no user is given the drafts for the authenticated user are returned - * - * @param \Ibexa\Contracts\Core\Repository\Values\User\User|null $user - * - * @return \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo[] Drafts owned by the given user - * - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\BadStateException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\UnauthorizedException - * @throws \Ibexa\Contracts\Core\Repository\Exceptions\InvalidArgumentException - */ - public function loadContentDrafts(?User $user = null): iterable - { - // throw early if user has absolutely no access to versionread - if ($this->permissionResolver->hasAccess('content', 'versionread') === false) { - throw new UnauthorizedException('content', 'versionread'); - } - - $spiVersionInfoList = $this->persistenceHandler->contentHandler()->loadDraftsForUser( - $this->resolveUser($user)->getUserId() - ); - $versionInfoList = []; - foreach ($spiVersionInfoList as $spiVersionInfo) { - $versionInfo = $this->contentDomainMapper->buildVersionInfoDomainObject($spiVersionInfo); - // @todo: Change this to filter returned drafts by permissions instead of throwing - if (!$this->permissionResolver->canUser('content', 'versionread', $versionInfo)) { - throw new UnauthorizedException('content', 'versionread', ['contentId' => $versionInfo->contentInfo->id]); - } - - $versionInfoList[] = $versionInfo; - } - - return $versionInfoList; - } - public function loadContentDraftList(?User $user = null, int $offset = 0, int $limit = -1): ContentDraftList { $list = new ContentDraftList(); @@ -1998,21 +1961,6 @@ public function copyContent(ContentInfo $contentInfo, LocationCreateStruct $dest return $this->internalLoadContentById($content->id); } - public function loadRelations(APIVersionInfo $versionInfo): iterable - { - if ($versionInfo->isPublished()) { - $function = 'read'; - } else { - $function = 'versionread'; - } - - if (!$this->permissionResolver->canUser('content', $function, $versionInfo)) { - throw new UnauthorizedException('content', $function); - } - - return $this->internalLoadRelations($versionInfo); - } - /** * Loads all outgoing relations for the given version without checking the permissions. * diff --git a/src/lib/Repository/PermissionsCriterionHandler.php b/src/lib/Repository/PermissionsCriterionHandler.php deleted file mode 100644 index 0c495db131..0000000000 --- a/src/lib/Repository/PermissionsCriterionHandler.php +++ /dev/null @@ -1,49 +0,0 @@ -getPermissionsCriterion(); - if ($permissionCriterion === true || $permissionCriterion === false) { - return $permissionCriterion; - } - - // Merge with original $criterion - if ($criterion instanceof LogicalAnd) { - $criterion->criteria[] = $permissionCriterion; - } else { - $criterion = new LogicalAnd( - [ - $criterion, - $permissionCriterion, - ] - ); - } - - return true; - } -} diff --git a/src/lib/Repository/SiteAccessAware/ContentService.php b/src/lib/Repository/SiteAccessAware/ContentService.php index 6a7a79277a..ffad838ff7 100644 --- a/src/lib/Repository/SiteAccessAware/ContentService.php +++ b/src/lib/Repository/SiteAccessAware/ContentService.php @@ -157,11 +157,6 @@ public function countContentDrafts(?User $user = null): int return $this->service->countContentDrafts($user); } - public function loadContentDrafts(?User $user = null): iterable - { - return $this->service->loadContentDrafts($user); - } - public function loadContentDraftList(?User $user = null, int $offset = 0, int $limit = -1): ContentDraftList { return $this->service->loadContentDraftList($user, $offset, $limit); @@ -192,11 +187,6 @@ public function copyContent(ContentInfo $contentInfo, LocationCreateStruct $dest return $this->service->copyContent($contentInfo, $destinationLocationCreateStruct, $versionInfo); } - public function loadRelations(VersionInfo $versionInfo): iterable - { - return $this->service->loadRelations($versionInfo); - } - public function countRelations(VersionInfo $versionInfo, ?RelationType $type = null): int { return $this->service->countRelations($versionInfo, $type); diff --git a/src/lib/Repository/URLWildcardService.php b/src/lib/Repository/URLWildcardService.php index ba998af10f..3623370c99 100644 --- a/src/lib/Repository/URLWildcardService.php +++ b/src/lib/Repository/URLWildcardService.php @@ -317,10 +317,6 @@ private function validateUrls(string $sourceUrl, string $destinationUrl): void preg_match_all('(\\*)', $sourceUrl, $patterns); preg_match_all('({(\d+)})', $destinationUrl, $placeholders); - if (empty($patterns) || empty($placeholders)) { - throw new ContentValidationException('Invalid URL wildcards provided.'); - } - $patterns = array_map('intval', $patterns[0]); $placeholders = array_map('intval', $placeholders[1]); diff --git a/src/lib/Resources/settings/fieldtype_external_storages.yml b/src/lib/Resources/settings/fieldtype_external_storages.yml index d91e8f9144..32e8b780cc 100644 --- a/src/lib/Resources/settings/fieldtype_external_storages.yml +++ b/src/lib/Resources/settings/fieldtype_external_storages.yml @@ -16,7 +16,6 @@ services: $gateway: '@Ibexa\Core\FieldType\Image\ImageStorage\Gateway\DoctrineStorage' $ioService: '@Ibexa\Core\FieldType\Image\IO\Legacy' $pathGenerator: '@Ibexa\Core\FieldType\Image\PathGenerator\LegacyPathGenerator' - $imageSizeMetadataHandler: '@Ibexa\Core\IO\MetadataHandler\ImageSize' $aliasCleaner: '@Ibexa\Core\FieldType\Image\AliasCleanerInterface' $filePathNormalizer: '@Ibexa\Core\IO\FilePathNormalizerInterface' $fileExtensionBlackListValidator: '@Ibexa\Core\FieldType\Validator\FileExtensionBlackListValidator' @@ -59,6 +58,3 @@ services: arguments: ['@Ibexa\Core\FieldType\User\UserStorage\Gateway\DoctrineStorage'] tags: - {name: ibexa.field_type.storage.external.handler, alias: ezuser} - - Ibexa\Core\IO\MetadataHandler\ImageSize: - class: Ibexa\Core\IO\MetadataHandler\ImageSize diff --git a/tests/bundle/Core/DependencyInjection/Configuration/Parser/CommonTest.php b/tests/bundle/Core/DependencyInjection/Configuration/Parser/CommonTest.php index bad30add74..057b5da634 100644 --- a/tests/bundle/Core/DependencyInjection/Configuration/Parser/CommonTest.php +++ b/tests/bundle/Core/DependencyInjection/Configuration/Parser/CommonTest.php @@ -8,7 +8,6 @@ namespace Ibexa\Tests\Bundle\Core\DependencyInjection\Configuration\Parser; use Ibexa\Bundle\Core\DependencyInjection\Configuration\Parser\Common; -use Ibexa\Bundle\Core\DependencyInjection\Configuration\Suggestion\Collector\SuggestionCollectorInterface; use Ibexa\Bundle\Core\DependencyInjection\IbexaCoreExtension; use Symfony\Component\Yaml\Yaml; @@ -16,13 +15,8 @@ class CommonTest extends AbstractParserTestCase { private $minimalConfig; - /** @var \PHPUnit\Framework\MockObject\MockObject */ - private $suggestionCollector; - protected function getContainerExtensions(): array { - $this->suggestionCollector = $this->createMock(SuggestionCollectorInterface::class); - return [new IbexaCoreExtension([new Common()])]; } @@ -65,48 +59,6 @@ public function testDefaultPage() $this->assertConfigResolverParameterValue('index_page', null, self::EMPTY_SA_GROUP); } - public function testDatabaseSingleSiteaccess() - { - $this->expectException(\InvalidArgumentException::class); - - $this->load( - [ - 'system' => [ - 'ibexa_demo_site' => [ - 'database' => [ - 'type' => 'sqlite', - 'server' => 'localhost', - 'user' => 'root', - 'password' => 'root', - 'database_name' => 'ezdemo', - ], - ], - ], - ] - ); - } - - public function testDatabaseSiteaccessGroup() - { - $this->expectException(\InvalidArgumentException::class); - - $this->load( - [ - 'system' => [ - 'ibexa_demo_group' => [ - 'database' => [ - 'type' => 'sqlite', - 'server' => 'localhost', - 'user' => 'root', - 'password' => 'root', - 'database_name' => 'ezdemo', - ], - ], - ], - ] - ); - } - /** * Test defaults. */ @@ -118,7 +70,6 @@ public function testNonExistentSettings() $this->assertConfigResolverParameterValue('var_dir', 'var', 'ibexa_demo_site'); $this->assertConfigResolverParameterValue('storage_dir', 'storage', 'ibexa_demo_site'); $this->assertConfigResolverParameterValue('binary_dir', 'original', 'ibexa_demo_site'); - $this->assertConfigResolverParameterValue('session_name', '%ibexa.session_name.default%', 'ibexa_demo_site'); $this->assertConfigResolverParameterValue('http_cache.purge_servers', [], 'ibexa_demo_site'); $this->assertConfigResolverParameterValue('anonymous_user_id', 10, 'ibexa_demo_site'); $this->assertConfigResolverParameterValue('index_page', null, 'ibexa_demo_site'); @@ -146,7 +97,6 @@ public function testMiscSettings() 'var_dir' => $varDir, 'storage_dir' => $storageDir, 'binary_dir' => $binaryDir, - 'session_name' => $sessionName, 'index_page' => $indexPage, 'http_cache' => [ 'purge_servers' => $cachePurgeServers, @@ -161,7 +111,6 @@ public function testMiscSettings() $this->assertConfigResolverParameterValue('var_dir', $varDir, 'ibexa_demo_site'); $this->assertConfigResolverParameterValue('storage_dir', $storageDir, 'ibexa_demo_site'); $this->assertConfigResolverParameterValue('binary_dir', $binaryDir, 'ibexa_demo_site'); - $this->assertConfigResolverParameterValue('session_name', $sessionName, 'ibexa_demo_site'); $this->assertConfigResolverParameterValue('index_page', $indexPage, 'ibexa_demo_site'); $this->assertConfigResolverParameterValue('http_cache.purge_servers', $cachePurgeServers, 'ibexa_demo_site'); $this->assertConfigResolverParameterValue('anonymous_user_id', $anonymousUserId, 'ibexa_demo_site'); @@ -236,7 +185,6 @@ public function testSessionSettings(array $inputParams, array $expected) ); $this->assertConfigResolverParameterValue('session', $expected['session'], 'ibexa_demo_site'); - $this->assertConfigResolverParameterValue('session_name', $expected['session_name'], 'ibexa_demo_site'); } public function sessionSettingsProvider() @@ -262,42 +210,6 @@ public function sessionSettingsProvider() 'cookie_secure' => false, 'cookie_httponly' => true, ], - 'session_name' => 'foo', - ], - ], - [ - [ - 'session' => [ - 'name' => 'foo', - 'cookie_path' => '/foo', - 'cookie_domain' => 'foo.com', - 'cookie_lifetime' => 86400, - 'cookie_secure' => false, - 'cookie_httponly' => true, - ], - 'session_name' => 'bar', - ], - [ - 'session' => [ - 'name' => 'bar', - 'cookie_path' => '/foo', - 'cookie_domain' => 'foo.com', - 'cookie_lifetime' => 86400, - 'cookie_secure' => false, - 'cookie_httponly' => true, - ], - 'session_name' => 'bar', - ], - ], - [ - [ - 'session_name' => 'some_other_session_name', - ], - [ - 'session' => [ - 'name' => 'some_other_session_name', - ], - 'session_name' => 'some_other_session_name', ], ], ]; diff --git a/tests/bundle/Core/Imagine/VariationPathGenerator/WebpFormatVariationPathGeneratorTest.php b/tests/bundle/Core/Imagine/VariationPathGenerator/WebpFormatVariationPathGeneratorTest.php index adcbb83cd1..d12c11c382 100644 --- a/tests/bundle/Core/Imagine/VariationPathGenerator/WebpFormatVariationPathGeneratorTest.php +++ b/tests/bundle/Core/Imagine/VariationPathGenerator/WebpFormatVariationPathGeneratorTest.php @@ -9,14 +9,14 @@ namespace Ibexa\Tests\Bundle\Core\Imagine\VariationPathGenerator; use Ibexa\Bundle\Core\Imagine\Filter\FilterConfiguration; -use Ibexa\Bundle\Core\Imagine\VariationPathGenerator; use Ibexa\Bundle\Core\Imagine\VariationPathGenerator\WebpFormatVariationPathGenerator; +use Ibexa\Contracts\Core\Variation\VariationPathGenerator; +use PHPUnit\Framework\MockObject\MockObject; use PHPUnit\Framework\TestCase; final class WebpFormatVariationPathGeneratorTest extends TestCase { - /** @var \Ibexa\Bundle\Core\Imagine\VariationPathGenerator|\PHPUnit\Framework\MockObject\MockObject */ - private VariationPathGenerator $innerVariationPathGenerator; + private VariationPathGenerator&MockObject $innerVariationPathGenerator; /** @var \Ibexa\Bundle\Core\Imagine\Filter\FilterConfiguration|\PHPUnit\Framework\MockObject\MockObject */ private FilterConfiguration $filterConfiguration; diff --git a/tests/bundle/Core/Routing/DefaultRouterTest.php b/tests/bundle/Core/Routing/DefaultRouterTest.php index 71609b38cb..cd3a45a3a3 100644 --- a/tests/bundle/Core/Routing/DefaultRouterTest.php +++ b/tests/bundle/Core/Routing/DefaultRouterTest.php @@ -246,12 +246,7 @@ public function testGenerateReverseSiteAccessMatch() $siteAccessName = 'foo_test'; $siteAccessRouter = $this->createMock(SiteAccess\SiteAccessRouterInterface::class); $versatileMatcher = $this->createMock(SiteAccess\VersatileMatcher::class); - $simplifiedRequest = new SimplifiedRequest( - [ - 'host' => 'phoenix-rises.fm', - 'scheme' => 'http', - ] - ); + $simplifiedRequest = new SimplifiedRequest('http', 'phoenix-rises.fm'); $versatileMatcher ->expects(self::once()) ->method('getRequest') diff --git a/tests/integration/Core/BinaryBase/BinaryBaseStorage/BinaryBaseStorageTest.php b/tests/integration/Core/BinaryBase/BinaryBaseStorage/BinaryBaseStorageTest.php index 7caeab4292..ff1e891e99 100644 --- a/tests/integration/Core/BinaryBase/BinaryBaseStorage/BinaryBaseStorageTest.php +++ b/tests/integration/Core/BinaryBase/BinaryBaseStorage/BinaryBaseStorageTest.php @@ -8,7 +8,7 @@ namespace Ibexa\Tests\Integration\Core\BinaryBase\BinaryBaseStorage; -use Ibexa\Contracts\Core\FieldType\BinaryBase\PathGenerator; +use Ibexa\Contracts\Core\FieldType\BinaryBase\PathGeneratorInterface; use Ibexa\Contracts\Core\IO\MimeTypeDetector; use Ibexa\Contracts\Core\Persistence\Content\Field; use Ibexa\Contracts\Core\Persistence\Content\FieldValue; @@ -22,14 +22,14 @@ use Ibexa\Core\IO\Values\BinaryFile; use Ibexa\Core\IO\Values\BinaryFileCreateStruct; use Ibexa\Tests\Integration\Core\BaseCoreFieldTypeIntegrationTest; +use PHPUnit\Framework\MockObject\MockObject; class BinaryBaseStorageTest extends BaseCoreFieldTypeIntegrationTest { /** @var \Ibexa\Core\FieldType\BinaryBase\BinaryBaseStorage\Gateway|\PHPUnit\Framework\MockObject\MockObject */ protected $gateway; - /** @var \Ibexa\Contracts\Core\FieldType\BinaryBase\PathGenerator|\PHPUnit\Framework\MockObject\MockObject */ - protected $pathGeneratorMock; + protected PathGeneratorInterface&MockObject $pathGeneratorMock; /** @var \Ibexa\Core\IO\IOServiceInterface|\PHPUnit\Framework\MockObject\MockObject */ protected $ioServiceMock; @@ -45,7 +45,7 @@ protected function setUp(): void parent::setUp(); $this->gateway = $this->getStorageGateway(); - $this->pathGeneratorMock = $this->createMock(PathGenerator::class); + $this->pathGeneratorMock = $this->createMock(PathGeneratorInterface::class); $this->ioServiceMock = $this->createMock(IOServiceInterface::class); $this->fileExtensionBlackListValidatorMock = $this->createMock( FileExtensionBlackListValidator::class @@ -102,7 +102,7 @@ public function testStoreFieldData(VersionInfo $versionInfo, Field $field): void ->with($binaryFileCreateStruct) ->willReturn(new BinaryFile()); - $this->storage->storeFieldData($versionInfo, $field, $this->getContext()); + $this->storage->storeFieldData($versionInfo, $field); $this->expectNotToPerformAssertions(); } @@ -126,7 +126,7 @@ public function testCopyLegacyField(VersionInfo $versionInfo, Field $originalFie ], ]); - $flag = $this->storage->copyLegacyField($versionInfo, $field, $originalField, $this->getContext()); + $flag = $this->storage->copyLegacyField($versionInfo, $field, $originalField); self::assertFalse($flag); } diff --git a/tests/integration/Core/Image/ImageStorage/ImageStorageTest.php b/tests/integration/Core/Image/ImageStorage/ImageStorageTest.php index 024cbd5de5..a283a4be03 100644 --- a/tests/integration/Core/Image/ImageStorage/ImageStorageTest.php +++ b/tests/integration/Core/Image/ImageStorage/ImageStorageTest.php @@ -19,7 +19,6 @@ use Ibexa\Core\FieldType\Validator\FileExtensionBlackListValidator; use Ibexa\Core\IO\FilePathNormalizerInterface; use Ibexa\Core\IO\IOServiceInterface; -use Ibexa\Core\IO\MetadataHandler; use Ibexa\Core\IO\UrlRedecoratorInterface; use Ibexa\Core\IO\Values\BinaryFile; use Ibexa\Core\IO\Values\BinaryFileCreateStruct; @@ -33,9 +32,6 @@ final class ImageStorageTest extends BaseCoreFieldTypeIntegrationTest /** @var \Ibexa\Core\IO\UrlRedecoratorInterface|\PHPUnit\Framework\MockObject\MockObject */ private $redecorator; - /** @var \Ibexa\Core\IO\MetadataHandler|\PHPUnit\Framework\MockObject\MockObject */ - private $imageSizeMetadataHandler; - /** @var \Ibexa\Core\FieldType\Image\PathGenerator|\PHPUnit\Framework\MockObject\MockObject */ private $pathGenerator; @@ -60,7 +56,6 @@ protected function setUp(): void $this->redecorator = $this->createMock(UrlRedecoratorInterface::class); $this->gateway = new DoctrineStorage($this->redecorator, $this->getDatabaseConnection()); - $this->imageSizeMetadataHandler = $this->createMock(MetadataHandler::class); $this->pathGenerator = $this->createMock(PathGenerator::class); $this->aliasCleaner = $this->createMock(AliasCleanerInterface::class); $this->filePathNormalizer = $this->createMock(FilePathNormalizerInterface::class); @@ -70,7 +65,6 @@ protected function setUp(): void $this->gateway, $this->ioService, $this->pathGenerator, - $this->imageSizeMetadataHandler, $this->aliasCleaner, $this->filePathNormalizer, $this->fileExtensionBlackListValidator @@ -82,14 +76,6 @@ public function testHasFieldData(): void self::assertTrue($this->storage->hasFieldData()); } - /** - * @return array - */ - private function getContext(): array - { - return ['identifier' => 'LegacyStorage']; - } - /** * @dataProvider providerOfFieldData * @@ -106,7 +92,7 @@ public function testStoreFieldDataDuringCreate(VersionInfo $versionInfo, Field $ ->with($binaryFile->uri) ->willReturn($binaryFile->uri); - $this->storage->storeFieldData($versionInfo, $field, $this->getContext()); + $this->storage->storeFieldData($versionInfo, $field); self::assertSame(1, $this->gateway->countImageReferences($binaryFile->uri)); } @@ -126,7 +112,7 @@ public function testStoreFieldDataDuringUpdate(VersionInfo $versionInfo, Field $ ->with($binaryFile->uri) ->willReturn($binaryFile->uri); - $this->storage->storeFieldData($versionInfo, $field, $this->getContext()); + $this->storage->storeFieldData($versionInfo, $field); self::assertSame(1, $this->gateway->countImageReferences($binaryFile->uri)); } @@ -168,7 +154,7 @@ public function testStoreFieldDataDuringUpdateWithDifferentImage(VersionInfo $ve ->with($binaryFile->uri) ->willReturn($binaryFile->uri); - $this->storage->storeFieldData($versionInfo, $field, $this->getContext()); + $this->storage->storeFieldData($versionInfo, $field); self::assertSame(1, $this->gateway->countImageReferences($binaryFile->uri)); } @@ -208,8 +194,8 @@ private function runCommonStoreFieldDataMocks(Field $field): BinaryFile /** * @return iterable */ public function providerOfFieldData(): iterable diff --git a/tests/integration/Core/Repository/ContentService/UpdateContentTest.php b/tests/integration/Core/Repository/ContentService/UpdateContentTest.php index 0dd3f900f6..947d98be6b 100644 --- a/tests/integration/Core/Repository/ContentService/UpdateContentTest.php +++ b/tests/integration/Core/Repository/ContentService/UpdateContentTest.php @@ -47,11 +47,8 @@ public function testUpdateContentHavingPrivateRelation(): void // Read relations & check if count($relations) is unchanged self::setAdministratorUser(); - $relations = $contentService->loadRelations($folder->getVersionInfo()); - if ($relations instanceof \Traversable) { - $relations = iterator_to_array($relations); - } - self::assertCount(1, $relations); + $relations = $contentService->loadRelationList($folder->getVersionInfo()); + self::assertCount(1, $relations->items); } /** diff --git a/tests/integration/Core/Repository/ContentServiceAuthorizationTest.php b/tests/integration/Core/Repository/ContentServiceAuthorizationTest.php index 162b32d134..94710f5c9a 100644 --- a/tests/integration/Core/Repository/ContentServiceAuthorizationTest.php +++ b/tests/integration/Core/Repository/ContentServiceAuthorizationTest.php @@ -11,6 +11,7 @@ use Ibexa\Contracts\Core\Repository\Repository; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Location; +use Ibexa\Contracts\Core\Repository\Values\Content\Relation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\LanguageLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\LocationLimitation; use Ibexa\Contracts\Core\Repository\Values\User\Limitation\SubtreeLimitation; @@ -720,9 +721,7 @@ public function testCountContentDraftsReturnZero() } /** - * Test for the loadContentDrafts() method. - * - * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDrafts() + * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDraftList() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentDrafts * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentDrafts @@ -734,13 +733,11 @@ public function testLoadContentDraftsThrowsUnauthorizedException() $this->expectException(UnauthorizedException::class); $this->expectExceptionMessageMatches('/\'versionread\' \'content\'/'); - $this->contentService->loadContentDrafts(); + $this->contentService->loadContentDraftList(); } /** - * Test for the loadContentDrafts() method. - * - * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDrafts($user) + * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDraftList($user) * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadContentDrafts */ @@ -751,7 +748,7 @@ public function testLoadContentDraftsThrowsUnauthorizedExceptionWithUser() $this->expectException(UnauthorizedException::class); $this->expectExceptionMessageMatches('/\'versionread\' \'content\'/'); - $this->contentService->loadContentDrafts($this->administratorUser); + $this->contentService->loadContentDraftList($this->administratorUser); } /** @@ -916,9 +913,9 @@ public function testCopyContentThrowsUnauthorizedExceptionWithGivenVersion() /** * Test for the loadRelations() method. * - * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadRelations() + * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadRelationList() * - * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadRelations + * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadRelationList */ public function testLoadRelationsThrowsUnauthorizedException() { @@ -937,15 +934,15 @@ public function testLoadRelationsThrowsUnauthorizedException() $this->expectException(UnauthorizedException::class); $this->expectExceptionMessageMatches('/\'read\' \'content\'/'); - $this->contentService->loadRelations($versionInfo); + $this->contentService->loadRelationList($versionInfo); } /** * Test for the loadRelations() method. * - * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadRelations() + * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadRelationList() * - * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadRelations + * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testLoadRelationList */ public function testLoadRelationsForDraftVersionThrowsUnauthorizedException() { @@ -956,7 +953,7 @@ public function testLoadRelationsForDraftVersionThrowsUnauthorizedException() $this->expectException(UnauthorizedException::class); $this->expectExceptionMessageMatches('/\'versionread\' \'content\'/'); - $this->contentService->loadRelations($draft->versionInfo); + $this->contentService->loadRelationList($draft->versionInfo); } /** @@ -1073,7 +1070,7 @@ private function createAnonymousWithEditorRole() * related object, executing loadRelations() would not throw any exception, * only that the non-readable related object(s) won't be loaded. * - * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadRelations() + * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadRelationList() * * @depends Ibexa\Tests\Integration\Core\Repository\ContentServiceTest::testAddRelation */ @@ -1180,7 +1177,7 @@ public function testLoadRelationsWithUnauthorizedRelations() $this->permissionResolver->setCurrentUserReference($this->anonymousUser); // finaly load relations ( verify no exception is thrown ) - $actualRelations = $this->contentService->loadRelations($testFolder->getVersionInfo()); + $actualRelations = $this->contentService->loadRelationList($testFolder->getVersionInfo()); // assert results // verify that the only expected relations are from the 2 readable objects @@ -1193,13 +1190,18 @@ public function testLoadRelationsWithUnauthorizedRelations() // assert there are as many expected relations as actual ones self::assertEquals( count($expectedRelations), - count($actualRelations), + count($actualRelations->items), "Expected '" . count($expectedRelations) - . "' relations found '" . count($actualRelations) . "'" + . "' relations found '" . count($actualRelations->items) . "'" ); // assert each relation - foreach ($actualRelations as $relation) { + /** + * @var \Ibexa\Contracts\Core\Repository\Values\Content\RelationList\RelationListItemInterface $relationListItem + */ + foreach ($actualRelations as $relationListItem) { + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\Relation $relation */ + $relation = $relationListItem->getRelation(); $destination = $relation->destinationContentInfo; $expected = $expectedRelations[$destination->id]->destinationContentInfo; self::assertNotEmpty($expected, "Non expected relation with '{$destination->id}' id found"); @@ -1222,8 +1224,8 @@ public function testLoadRelationsWithUnauthorizedRelations() self::assertCount( 0, $expectedRelations, - "Expected to find '" . (count($expectedRelations) + count($actualRelations)) - . "' relations found '" . count($actualRelations) . "'" + "Expected to find '" . (count($expectedRelations) + count($actualRelations->items)) + . "' relations found '" . count($actualRelations->items) . "'" ); } diff --git a/tests/integration/Core/Repository/ContentServiceTest.php b/tests/integration/Core/Repository/ContentServiceTest.php index 510a779711..5ec286ff98 100644 --- a/tests/integration/Core/Repository/ContentServiceTest.php +++ b/tests/integration/Core/Repository/ContentServiceTest.php @@ -22,6 +22,7 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Language; use Ibexa\Contracts\Core\Repository\Values\Content\Location; use Ibexa\Contracts\Core\Repository\Values\Content\Relation; +use Ibexa\Contracts\Core\Repository\Values\Content\RelationList\RelationListItemInterface; use Ibexa\Contracts\Core\Repository\Values\Content\RelationType; use Ibexa\Contracts\Core\Repository\Values\Content\Section; use Ibexa\Contracts\Core\Repository\Values\Content\URLAlias; @@ -1385,7 +1386,7 @@ public function testCreateContentDraftSetsExpectedProperties($draft) ], [ 'fieldCount' => count($draft->getFields()), - 'relationCount' => count($this->getRepository()->getContentService()->loadRelations($draft->getVersionInfo())), + 'relationCount' => count($this->getRepository()->getContentService()->loadRelationList($draft->getVersionInfo())->items), ] ); } @@ -2404,25 +2405,21 @@ public function testCountContentDraftsForUsers(): void } /** - * Test for the loadContentDrafts() method. - * - * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDrafts() + * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDraftList() */ public function testLoadContentDraftsReturnsEmptyArrayByDefault() { - $contentDrafts = $this->contentService->loadContentDrafts(); + $contentDrafts = $this->contentService->loadContentDraftList(); - self::assertSame([], $contentDrafts); + self::assertSame([], $contentDrafts->items); } /** - * Test for the loadContentDrafts() method. - * - * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDrafts() + * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDraftList() * * @depends testCreateContentDraft */ - public function testLoadContentDrafts() + public function testLoadContentDraftList(): void { // "Media" content object $mediaContentInfo = $this->contentService->loadContentInfoByRemoteId(self::MEDIA_REMOTE_ID); @@ -2435,13 +2432,20 @@ public function testLoadContentDrafts() $this->contentService->createContentDraft($demoDesignContentInfo); // Now $contentDrafts should contain two drafted versions - $draftedVersions = iterator_to_array($this->contentService->loadContentDrafts()); + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\DraftList\ContentDraftListItemInterface[] $draftedVersions */ + $draftedVersions = iterator_to_array($this->contentService->loadContentDraftList()->getIterator()); + + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $draftedVersionInfo0 */ + $draftedVersionInfo0 = $draftedVersions[0]->getVersionInfo(); + + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $draftedVersionInfo1 */ + $draftedVersionInfo1 = $draftedVersions[1]->getVersionInfo(); $actual = [ - $draftedVersions[0]->status, - $draftedVersions[0]->getContentInfo()->remoteId, - $draftedVersions[1]->status, - $draftedVersions[1]->getContentInfo()->remoteId, + $draftedVersionInfo0->status, + $draftedVersionInfo0->getContentInfo()->remoteId, + $draftedVersionInfo1->status, + $draftedVersionInfo1->getContentInfo()->remoteId, ]; sort($actual, SORT_STRING); @@ -2457,9 +2461,7 @@ public function testLoadContentDrafts() } /** - * Test for the loadContentDrafts() method. - * - * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDrafts($user) + * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDraftList($user) */ public function testLoadContentDraftsWithFirstParameter() { @@ -2481,32 +2483,35 @@ public function testLoadContentDraftsWithFirstParameter() $this->permissionResolver->setCurrentUserReference($oldCurrentUser); // Now $contentDrafts for the previous current user and the new user - $newCurrentUserDrafts = iterator_to_array($this->contentService->loadContentDrafts($user)); - $oldCurrentUserDrafts = iterator_to_array($this->contentService->loadContentDrafts()); + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\DraftList\ContentDraftListItemInterface[] $newCurrentUserDrafts */ + $newCurrentUserDrafts = iterator_to_array($this->contentService->loadContentDraftList($user)->getIterator()); + $oldCurrentUserDrafts = iterator_to_array($this->contentService->loadContentDraftList()->getIterator()); self::assertSame([], $oldCurrentUserDrafts); + /** @var \Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo $newCurrentUserDraftVersionInfo */ + $newCurrentUserDraftVersionInfo = $newCurrentUserDrafts[0]->getVersionInfo(); self::assertEquals( [ VersionInfo::STATUS_DRAFT, self::MEDIA_REMOTE_ID, ], [ - $newCurrentUserDrafts[0]->status, - $newCurrentUserDrafts[0]->getContentInfo()->remoteId, + $newCurrentUserDraftVersionInfo->status, + $newCurrentUserDraftVersionInfo->getContentInfo()->remoteId, ] ); - self::assertTrue($newCurrentUserDrafts[0]->isDraft()); - self::assertFalse($newCurrentUserDrafts[0]->isArchived()); - self::assertFalse($newCurrentUserDrafts[0]->isPublished()); + self::assertTrue($newCurrentUserDraftVersionInfo->isDraft()); + self::assertFalse($newCurrentUserDraftVersionInfo->isArchived()); + self::assertFalse($newCurrentUserDraftVersionInfo->isPublished()); } /** * Test for the loadContentDraftList() method. * - * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDrafts() + * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDraftList() */ - public function testLoadContentDraftListWithPaginationParameters() + public function testLoadContentDraftListWithPaginationParameters(): void { // Create some drafts $publishedContent = $this->createContentVersion1(); @@ -2530,9 +2535,9 @@ public function testLoadContentDraftListWithPaginationParameters() /** * Test for the loadContentDraftList() method. * - * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDrafts($user) + * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDraftList($user) */ - public function testLoadContentDraftListWithForUserWithLimitation() + public function testLoadContentDraftListWithForUserWithLimitation(): void { $oldUser = $this->permissionResolver->getCurrentUserReference(); @@ -2569,9 +2574,9 @@ public function testLoadContentDraftListWithForUserWithLimitation() /** * Test for the loadContentDraftList() method. * - * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDrafts() + * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadContentDraftList() */ - public function testLoadAllContentDrafts() + public function testLoadAllContentDraftList(): void { // Create more drafts then default pagination limit $this->createContentDrafts(12); @@ -3518,7 +3523,10 @@ public function testAddRelation(): array self::assertInstanceOf(Relation::class, $relation); - return $this->contentService->loadRelations($draft->getVersionInfo()); + return array_filter(array_map( + static fn (RelationListItemInterface $relationListItem): ?Relation => $relationListItem->getRelation(), + $this->contentService->loadRelationList($draft->getVersionInfo())->items + )); } /** @@ -3596,7 +3604,10 @@ public function testCreateContentDraftWithRelations() $content = $this->contentService->publishVersion($draft->versionInfo); $newDraft = $this->contentService->createContentDraft($content->contentInfo); - return $this->contentService->loadRelations($newDraft->getVersionInfo()); + return array_filter(array_map( + static fn (RelationListItemInterface $relationListItem): ?Relation => $relationListItem->getRelation(), + $this->contentService->loadRelationList($newDraft->getVersionInfo())->items + )); } /** @@ -3655,57 +3666,10 @@ public function testAddRelationThrowsBadStateException() /** * Test for the loadRelations() method. * - * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadRelations() + * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadRelationList() * * @depends testAddRelation - */ - public function testLoadRelations() - { - $draft = $this->createContentWithRelations(); - - $relations = iterator_to_array($this->contentService->loadRelations($draft->getVersionInfo())); - - usort( - $relations, - static function ($rel1, $rel2): int { - return strcasecmp( - $rel2->getDestinationContentInfo()->remoteId, - $rel1->getDestinationContentInfo()->remoteId - ); - } - ); - - self::assertEquals( - [ - [ - 'sourceContentInfo' => 'abcdef0123456789abcdef0123456789', - 'destinationContentInfo' => self::MEDIA_REMOTE_ID, - ], - [ - 'sourceContentInfo' => 'abcdef0123456789abcdef0123456789', - 'destinationContentInfo' => self::DEMO_DESIGN_REMOTE_ID, - ], - ], - [ - [ - 'sourceContentInfo' => $relations[0]->sourceContentInfo->remoteId, - 'destinationContentInfo' => $relations[0]->destinationContentInfo->remoteId, - ], - [ - 'sourceContentInfo' => $relations[1]->sourceContentInfo->remoteId, - 'destinationContentInfo' => $relations[1]->destinationContentInfo->remoteId, - ], - ] - ); - } - - /** - * Test for the loadRelations() method. - * - * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadRelations() - * - * @depends testAddRelation - * @depends testLoadRelations + * @depends loadRelationList */ public function testLoadRelationsSkipsArchivedContent() { @@ -3736,7 +3700,7 @@ public function testLoadRelationsSkipsArchivedContent() $trashService->trash($demoDesignLocation); // Load all relations - $relations = iterator_to_array($this->contentService->loadRelations($draft->getVersionInfo())); + $relations = iterator_to_array($this->contentService->loadRelationList($draft->getVersionInfo())->getIterator()); self::assertCount(1, $relations); self::assertEquals( @@ -3758,10 +3722,10 @@ public function testLoadRelationsSkipsArchivedContent() /** * Test for the loadRelations() method. * - * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadRelations() + * @covers \Ibexa\Contracts\Core\Repository\ContentService::loadRelationList() * * @depends testAddRelation - * @depends testLoadRelations + * @depends loadRelationList */ public function testLoadRelationsSkipsDraftContent() { @@ -3787,7 +3751,7 @@ public function testLoadRelationsSkipsDraftContent() $demoDesign ); - $relations = iterator_to_array($this->contentService->loadRelations($mediaDraft->getVersionInfo())); + $relations = iterator_to_array($this->contentService->loadRelationList($mediaDraft->getVersionInfo())->getIterator()); self::assertCount(1, $relations); self::assertEquals( @@ -4020,7 +3984,7 @@ public function testLoadReverseRelations() $this->contentService->publishVersion($mediaDraft->getVersionInfo()); $this->contentService->publishVersion($demoDesignDraft->getVersionInfo()); - $relations = $this->contentService->loadRelations($versionInfo); + $relations = $this->contentService->loadRelationList($versionInfo); $reverseRelations = iterator_to_array($this->contentService->loadReverseRelations($contentInfo)); self::assertEquals($contentInfo->id, $relation1->getDestinationContentInfo()->id); @@ -4112,7 +4076,7 @@ public function testLoadReverseRelationsSkipsArchivedContent() $trashService->trash($demoDesignLocation); // Load all relations - $relations = $this->contentService->loadRelations($versionInfo); + $relations = $this->contentService->loadRelationList($versionInfo); $reverseRelations = iterator_to_array($this->contentService->loadReverseRelations($contentInfo)); self::assertEquals($contentInfo->id, $relation1->getDestinationContentInfo()->id); @@ -4176,7 +4140,7 @@ public function testLoadReverseRelationsSkipsDraftContent() // We will not publish new Content draft, therefore relation from it // will not be loaded as reverse relation for "Media" page - $relations = $this->contentService->loadRelations($media->versionInfo); + $relations = $this->contentService->loadRelationList($media->versionInfo); $reverseRelations = iterator_to_array($this->contentService->loadReverseRelations($media->contentInfo)); self::assertEquals($media->contentInfo->id, $relation1->getDestinationContentInfo()->id); @@ -4380,7 +4344,7 @@ public function testLoadReverseRelationListWithType(): void * * @covers \Ibexa\Contracts\Core\Repository\ContentService::deleteRelation() * - * @depends testLoadRelations + * @depends testLoadRelationList */ public function testDeleteRelation() { @@ -4397,7 +4361,7 @@ public function testDeleteRelation() $this->contentService->deleteRelation($draft->getVersionInfo(), $media); // The relations array now contains only one element - $relations = $this->contentService->loadRelations($draft->getVersionInfo()); + $relations = $this->contentService->loadRelationList($draft->getVersionInfo()); self::assertCount(1, $relations); } @@ -5051,7 +5015,7 @@ public function testUpdateContentMetadataCheckWithinTransaction() * * @depends testCreateContent * @depends testLoadContentInfo - * @depends testLoadContentDrafts + * @depends testLoadContentDraftList */ public function testDeleteVersionInTransactionWithRollback() { @@ -5079,9 +5043,9 @@ public function testDeleteVersionInTransactionWithRollback() $repository->rollback(); // This array will be empty - $drafts = $this->contentService->loadContentDrafts(); + $drafts = $this->contentService->loadContentDraftList(); - self::assertSame([], $drafts); + self::assertSame([], $drafts->items); } /** @@ -5119,9 +5083,9 @@ public function testDeleteVersionInTransactionWithCommit() } // This array will contain no element - $drafts = $this->contentService->loadContentDrafts(); + $drafts = $this->contentService->loadContentDraftList(); - self::assertSame([], $drafts); + self::assertSame([], $drafts->items); } /** @@ -6801,7 +6765,7 @@ private function createParentLocationsForHideReveal(int $parentLocationId): arra $this->createFolder([self::ENG_US => 'P3'], $parentLocationId)->contentInfo->mainLocationId, ]; - return array_values($this->locationService->loadLocationList($parentFoldersLocationsIds)); + return array_values([...$this->locationService->loadLocationList($parentFoldersLocationsIds)]); } /** diff --git a/tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php b/tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php index f1ed678eb4..ca1403263e 100644 --- a/tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/RelationIntegrationTest.php @@ -109,7 +109,7 @@ public function getSettingsSchema() } /** - * @covers \Ibexa\Contracts\Core\Repository\Tests\FieldType\BaseIntegrationTest::getValidatorSchema() + * @covers \Ibexa\Tests\Integration\Core\Repository\FieldType\BaseIntegrationTest::getValidatorSchema() */ public function getValidatorSchema() { @@ -230,10 +230,8 @@ public function provideInvalidCreationFieldData() /** * Get update field externals data. - * - * @return array */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): RelationValue { return new RelationValue(49); } @@ -242,10 +240,8 @@ public function getValidUpdateFieldData() * Get externals updated field data values. * * This is a PHPUnit data provider - * - * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf(RelationValue::class, $field->value); @@ -271,7 +267,7 @@ public function provideInvalidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertInstanceOf( RelationValue::class, diff --git a/tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php b/tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php index 19fd77c786..5da099b74c 100644 --- a/tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php +++ b/tests/integration/Core/Repository/FieldType/RelationListIntegrationTest.php @@ -259,10 +259,8 @@ public function provideInvalidCreationFieldData() /** * Get update field externals data. - * - * @return array */ - public function getValidUpdateFieldData() + public function getValidUpdateFieldData(): RelationListValue { return new RelationListValue([49, 54, 4]); } @@ -271,10 +269,8 @@ public function getValidUpdateFieldData() * Get externals updated field data values. * * This is a PHPUnit data provider - * - * @return array */ - public function assertUpdatedFieldDataLoadedCorrect(Field $field) + public function assertUpdatedFieldDataLoadedCorrect(Field $field): void { self::assertInstanceOf(RelationListValue::class, $field->value); @@ -300,7 +296,7 @@ public function provideInvalidUpdateFieldData() * * @param \Ibexa\Contracts\Core\Repository\Values\Content\Field $field */ - public function assertCopiedFieldDataLoadedCorrectly(Field $field) + public function assertCopiedFieldDataLoadedCorrectly(Field $field): void { self::assertInstanceOf( RelationListValue::class, diff --git a/tests/integration/Core/Repository/FieldType/RelationSearchBaseIntegrationTestTrait.php b/tests/integration/Core/Repository/FieldType/RelationSearchBaseIntegrationTestTrait.php index a6acd700d7..7e6662dcab 100644 --- a/tests/integration/Core/Repository/FieldType/RelationSearchBaseIntegrationTestTrait.php +++ b/tests/integration/Core/Repository/FieldType/RelationSearchBaseIntegrationTestTrait.php @@ -9,6 +9,9 @@ use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct; +use Ibexa\Contracts\Core\Repository\Values\Content\Relation as RelationContract; +use Ibexa\Contracts\Core\Repository\Values\Content\RelationList; +use Ibexa\Contracts\Core\Repository\Values\Content\RelationList\RelationListItemInterface; use Ibexa\Core\Repository\Values\Content\Relation; /** @@ -48,7 +51,9 @@ public function testCreateContentRelationsProcessedCorrect() $this->getCreateExpectedRelations($content) ), $this->normalizeRelations( - $this->getRepository()->getContentService()->loadRelations($content->versionInfo) + $this->getRelations( + $this->getRepository()->getContentService()->loadRelationList($content->versionInfo) + ) ) ); } @@ -65,7 +70,9 @@ public function testUpdateContentRelationsProcessedCorrect() $this->getUpdateExpectedRelations($content) ), $this->normalizeRelations( - $this->getRepository()->getContentService()->loadRelations($content->versionInfo) + $this->getRelations( + $this->getRepository()->getContentService()->loadRelationList($content->versionInfo) + ) ) ); } @@ -73,7 +80,7 @@ public function testUpdateContentRelationsProcessedCorrect() /** * Normalizes given $relations for easier comparison. * - * @param \Ibexa\Core\Repository\Values\Content\Relation[] $relations + * @param \Ibexa\Contracts\Core\Repository\Values\Content\Relation[] $relations * * @return \Ibexa\Core\Repository\Values\Content\Relation[] */ @@ -81,7 +88,7 @@ protected function normalizeRelations(array $relations) { usort( $relations, - static function (Relation $a, Relation $b): int { + static function (RelationContract $a, RelationContract $b): int { if ($a->type == $b->type) { return $a->destinationContentInfo->id < $b->destinationContentInfo->id ? 1 : -1; } @@ -90,7 +97,7 @@ static function (Relation $a, Relation $b): int { } ); $normalized = array_map( - static function (Relation $relation) { + static function (RelationContract $relation) { $newRelation = new Relation( [ 'id' => null, @@ -125,7 +132,9 @@ public function testCopyContentCopiesFieldRelations() $this->getUpdateExpectedRelations($copy) ), $this->normalizeRelations( - $this->getRepository()->getContentService()->loadRelations($copy->versionInfo) + $this->getRelations( + $this->getRepository()->getContentService()->loadRelationList($copy->versionInfo) + ) ) ); @@ -135,7 +144,9 @@ public function testCopyContentCopiesFieldRelations() $this->getCreateExpectedRelations($firstVersion) ), $this->normalizeRelations( - $this->getRepository()->getContentService()->loadRelations($firstVersion->versionInfo) + $this->getRelations( + $this->getRepository()->getContentService()->loadRelationList($firstVersion->versionInfo) + ) ) ); } @@ -157,13 +168,27 @@ public function testSubtreeCopyContentCopiesFieldRelations() ); $copy = $contentService->loadContent($copiedLocation->getContentInfo()->id); + $this->assertEquals( $this->normalizeRelations( $this->getCreateExpectedRelations($copy) ), $this->normalizeRelations( - $this->getRepository()->getContentService()->loadRelations($copy->versionInfo) + $this->getRelations( + $this->getRepository()->getContentService()->loadRelationList($copy->versionInfo) + ) ) ); } + + /** + * @return \Ibexa\Contracts\Core\Repository\Values\Content\Relation[] + */ + private function getRelations(RelationList $relationList): array + { + return array_filter(array_map( + static fn (RelationListItemInterface $relationListItem): ?RelationContract => $relationListItem->getRelation(), + $relationList->items + )); + } } diff --git a/tests/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPassTest.php b/tests/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPassTest.php index f26747bd7d..3711c3b798 100644 --- a/tests/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPassTest.php +++ b/tests/lib/Base/Container/Compiler/Storage/ExternalStorageRegistryPassTest.php @@ -100,12 +100,6 @@ public function testRegisterExternalStorageHandlerWithGateway(string $tag) 'register', [$fieldTypeIdentifier, new Reference($storageHandlerServiceId)] ); - - $this->assertContainerBuilderHasServiceDefinitionWithMethodCall( - $storageHandlerServiceId, - 'addGateway', - [$gatewayIdentifier, new Reference($gatewayServiceId)] - ); } /** diff --git a/tests/lib/Base/Container/Compiler/Stubs/GatewayBasedStorageHandler.php b/tests/lib/Base/Container/Compiler/Stubs/GatewayBasedStorageHandler.php index 04f9ca0c5a..668ead0950 100644 --- a/tests/lib/Base/Container/Compiler/Stubs/GatewayBasedStorageHandler.php +++ b/tests/lib/Base/Container/Compiler/Stubs/GatewayBasedStorageHandler.php @@ -7,33 +7,28 @@ namespace Ibexa\Tests\Core\Base\Container\Compiler\Stubs; +use Ibexa\Contracts\Core\FieldType\GatewayBasedStorage; use Ibexa\Contracts\Core\Persistence\Content\Field; use Ibexa\Contracts\Core\Persistence\Content\VersionInfo; -use Ibexa\Core\FieldType\GatewayBasedStorage; /** * Stub implementation of GatewayBasedStorage. */ class GatewayBasedStorageHandler extends GatewayBasedStorage { - public function storeFieldData(VersionInfo $versionInfo, Field $field, array $context) + public function storeFieldData(VersionInfo $versionInfo, Field $field) { } - public function getFieldData(VersionInfo $versionInfo, Field $field, array $context) + public function getFieldData(VersionInfo $versionInfo, Field $field) { } - public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds, array $context) + public function deleteFieldData(VersionInfo $versionInfo, array $fieldIds) { } public function hasFieldData() { } - - public function getIndexData(VersionInfo $versionInfo, Field $field, array $context): array - { - return []; - } } diff --git a/tests/lib/FieldType/Image/IO/LegacyTest.php b/tests/lib/FieldType/Image/IO/LegacyTest.php index 4315db0030..33a74ea5b1 100644 --- a/tests/lib/FieldType/Image/IO/LegacyTest.php +++ b/tests/lib/FieldType/Image/IO/LegacyTest.php @@ -47,20 +47,6 @@ protected function setUp(): void ); } - public function testGetExternalPath() - { - $this->publishedIoServiceMock - ->expects(self::once()) - ->method('getExternalPath') - ->with('var/test/storage/images/path/file.png') - ->will(self::returnValue('path/file.png')); - - self::assertEquals( - 'path/file.png', - $this->service->getExternalPath('var/test/storage/images/path/file.png') - ); - } - public function testNewBinaryCreateStructFromLocalFile() { $path = '/tmp/file.png'; @@ -95,25 +81,6 @@ public function testExists() ); } - public function testGetInternalPath() - { - $id = 'path/file.png'; - $internalPath = 'var/test/storage/images/path/file.png'; - - $this->publishedIoServiceMock - ->expects(self::once()) - ->method('getInternalPath') - ->with($id) - ->will(self::returnValue($internalPath)); - - $this->draftIoServiceMock->expects(self::never())->method('getInternalPath'); - - self::assertEquals( - $internalPath, - $this->service->getInternalPath($id) - ); - } - /** * Standard binary file, with regular id. */ @@ -147,14 +114,8 @@ public function testLoadBinaryFileDraftInternalPath() $this->draftIoServiceMock ->expects(self::once()) - ->method('getExternalPath') + ->method('loadBinaryFileByUri') ->with($internalId) - ->will(self::returnValue($id)); - - $this->draftIoServiceMock - ->expects(self::once()) - ->method('loadBinaryFile') - ->with($id) ->will(self::returnValue($binaryFile)); $this->publishedIoServiceMock->expects(self::never())->method('loadBinaryFile'); @@ -176,14 +137,8 @@ public function testLoadBinaryFilePublishedInternalPath() $this->publishedIoServiceMock ->expects(self::once()) - ->method('getExternalPath') + ->method('loadBinaryFileByUri') ->with($internalId) - ->will(self::returnValue($id)); - - $this->publishedIoServiceMock - ->expects(self::once()) - ->method('loadBinaryFile') - ->with($id) ->will(self::returnValue($binaryFile)); $this->draftIoServiceMock->expects(self::never())->method('loadBinaryFile'); @@ -202,9 +157,6 @@ public function testLoadBinaryFileDraftExternalPath() $id = 'path/file.jpg'; $binaryFile = new BinaryFile(['id' => $id]); - $this->draftIoServiceMock->expects(self::never())->method('getExternalPath'); - $this->publishedIoServiceMock->expects(self::never())->method('getExternalPath'); - $this->publishedIoServiceMock ->expects(self::once()) ->method('loadBinaryFile') diff --git a/tests/lib/FieldType/Url/UrlStorageTest.php b/tests/lib/FieldType/Url/UrlStorageTest.php index f5514790f6..9d8c0c9857 100644 --- a/tests/lib/FieldType/Url/UrlStorageTest.php +++ b/tests/lib/FieldType/Url/UrlStorageTest.php @@ -45,7 +45,7 @@ public function testStoreFieldDataWithExistingUrl() ); $storage = $this->getPartlyMockedStorage($gateway); - $result = $storage->storeFieldData($versionInfo, $field, $this->getContext()); + $result = $storage->storeFieldData($versionInfo, $field); self::assertTrue($result); self::assertEquals(12, $field->value->data['urlId']); @@ -85,7 +85,7 @@ public function testStoreFieldDataWithNewUrl() ); $storage = $this->getPartlyMockedStorage($gateway); - $result = $storage->storeFieldData($versionInfo, $field, $this->getContext()); + $result = $storage->storeFieldData($versionInfo, $field); self::assertTrue($result); self::assertEquals(12, $field->value->data['urlId']); @@ -115,7 +115,7 @@ public function testStoreFieldDataWithEmptyUrl() ->method('unlinkUrl'); $storage = $this->getPartlyMockedStorage($gateway); - $result = $storage->storeFieldData($versionInfo, $field, $this->getContext()); + $result = $storage->storeFieldData($versionInfo, $field); self::assertFalse($result); self::assertNull($field->value->data); @@ -135,7 +135,7 @@ public function testGetFieldData() ->will(self::returnValue([12 => 'http://ibexa.co'])); $storage = $this->getPartlyMockedStorage($gateway); - $storage->getFieldData($versionInfo, $field, $this->getContext()); + $storage->getFieldData($versionInfo, $field); self::assertEquals('http://ibexa.co', $field->value->externalData); } @@ -160,7 +160,7 @@ public function testGetFieldDataNotFound() ->method('error') ->with("URL with ID '12' not found"); - $storage->getFieldData($versionInfo, $field, $this->getContext()); + $storage->getFieldData($versionInfo, $field); self::assertEquals('', $field->value->externalData); } @@ -182,7 +182,7 @@ public function testGetFieldDataWithEmptyUrlId() ->method('error'); $storage = $this->getPartlyMockedStorage($gateway); - $storage->getFieldData($versionInfo, $field, $this->getContext()); + $storage->getFieldData($versionInfo, $field); self::assertNull($field->value->externalData); } @@ -201,7 +201,7 @@ public function testDeleteFieldData() } $storage = $this->getPartlyMockedStorage($gateway); - $storage->deleteFieldData($versionInfo, $fieldIds, $this->getContext()); + $storage->deleteFieldData($versionInfo, $fieldIds); } public function testHasFieldData() @@ -229,14 +229,6 @@ protected function getPartlyMockedStorage(StorageGatewayInterface $gateway) ->getMock(); } - /** - * @return array - */ - protected function getContext() - { - return ['context']; - } - /** @var \Psr\Log\LoggerInterface|\PHPUnit\Framework\MockObject\MockObject */ protected $loggerMock; diff --git a/tests/lib/Helper/PreviewLocationProviderTest.php b/tests/lib/Helper/PreviewLocationProviderTest.php index e3cd8898bb..2db4957a3e 100644 --- a/tests/lib/Helper/PreviewLocationProviderTest.php +++ b/tests/lib/Helper/PreviewLocationProviderTest.php @@ -8,7 +8,6 @@ namespace Ibexa\Tests\Core\Helper; use Ibexa\Contracts\Core\Persistence\Content\Location\Handler as SPILocationHandler; -use Ibexa\Contracts\Core\Repository\ContentService; use Ibexa\Contracts\Core\Repository\LocationService; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo as APIContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\Location as APILocation; @@ -20,9 +19,6 @@ class PreviewLocationProviderTest extends TestCase { - /** @var \Ibexa\Contracts\Core\Repository\LocationService|\PHPUnit\Framework\MockObject\MockObject */ - private $contentService; - /** @var \Ibexa\Contracts\Core\Repository\LocationService|\PHPUnit\Framework\MockObject\MockObject */ private $locationService; @@ -36,10 +32,9 @@ protected function setUp(): void { parent::setUp(); - $this->contentService = $this->createMock(ContentService::class); $this->locationService = $this->createMock(LocationService::class); $this->locationHandler = $this->createMock(SPILocationHandler::class); - $this->provider = new PreviewLocationProvider($this->locationService, $this->contentService, $this->locationHandler); + $this->provider = new PreviewLocationProvider($this->locationService, $this->locationHandler); } public function testGetPreviewLocationDraft() @@ -48,12 +43,6 @@ public function testGetPreviewLocationDraft() $parentLocationId = 456; $content = $this->getContentMock($contentId); - $this->contentService - ->expects(self::once()) - ->method('loadContent') - ->with($contentId) - ->willReturn($content); - $this->locationService ->expects(self::never()) ->method('loadLocation'); @@ -64,7 +53,7 @@ public function testGetPreviewLocationDraft() ->with($contentId) ->will(self::returnValue([new Location(['id' => $parentLocationId])])); - $location = $this->provider->loadMainLocation($contentId); + $location = $this->provider->loadMainLocationByContent($content); self::assertInstanceOf(APILocation::class, $location); self::assertSame($content, $location->getContent()); self::assertNull($location->id); @@ -82,12 +71,6 @@ public function testGetPreviewLocation() ->setConstructorArgs([['id' => $locationId, 'content' => $content]]) ->getMockForAbstractClass(); - $this->contentService - ->expects(self::once()) - ->method('loadContent') - ->with($contentId) - ->willReturn($content); - $this->locationService ->expects(self::once()) ->method('loadLocation') @@ -96,7 +79,7 @@ public function testGetPreviewLocation() $this->locationHandler->expects(self::never())->method('loadParentLocationsForDraftContent'); - $returnedLocation = $this->provider->loadMainLocation($contentId); + $returnedLocation = $this->provider->loadMainLocationByContent($content); self::assertSame($location, $returnedLocation); self::assertSame($content, $location->getContent()); } @@ -106,12 +89,6 @@ public function testGetPreviewLocationNoLocation() $contentId = 123; $content = $this->getContentMock($contentId); - $this->contentService - ->expects(self::once()) - ->method('loadContent') - ->with($contentId) - ->willReturn($content); - $this->locationHandler ->expects(self::once()) ->method('loadParentLocationsForDraftContent') @@ -120,7 +97,7 @@ public function testGetPreviewLocationNoLocation() $this->locationHandler->expects(self::never())->method('loadLocationsByContent'); - self::assertNull($this->provider->loadMainLocation($contentId)); + self::assertNull($this->provider->loadMainLocationByContent($content)); } private function getContentMock(int $contentId, ?int $mainLocationId = null, bool $published = false): Content diff --git a/tests/lib/IO/ConfigScopeChangeAwareIOServiceTest.php b/tests/lib/IO/ConfigScopeChangeAwareIOServiceTest.php index 1a50e61440..8b3e0b1fb6 100644 --- a/tests/lib/IO/ConfigScopeChangeAwareIOServiceTest.php +++ b/tests/lib/IO/ConfigScopeChangeAwareIOServiceTest.php @@ -74,23 +74,6 @@ public function testSetPrefix(): void $this->ioService->setPrefix(self::PREFIX); } - public function testGetExternalPath(): void - { - $internalId = 10; - $expectedExternalPath = '/example/external/path'; - - $this->innerIOService - ->expects(self::once()) - ->method('getExternalPath') - ->with($internalId) - ->willReturn($expectedExternalPath) - ; - - $externalPath = $this->ioService->getExternalPath($internalId); - - self::assertEquals($expectedExternalPath, $externalPath); - } - public function testNewBinaryCreateStructFromLocalFile(): void { $expectedBinaryFileCreateStruct = new BinaryFileCreateStruct(); @@ -122,23 +105,6 @@ public function testExists(): void self::assertTrue($this->innerIOService->exists($binaryFileId)); } - public function testGetInternalPath(): void - { - $expectedInternalPath = new BinaryFileCreateStruct(); - $externalId = 'test-id'; - - $this->innerIOService - ->expects(self::once()) - ->method('getInternalPath') - ->with($externalId) - ->willReturn($expectedInternalPath) - ; - - $internalPath = $this->innerIOService->getInternalPath($externalId); - - self::assertEquals($expectedInternalPath, $internalPath); - } - public function testLoadBinaryFile(): void { $expectedBinaryFile = new BinaryFile(); diff --git a/tests/lib/IO/IOMetadataHandler/LegacyDFSClusterTest.php b/tests/lib/IO/IOMetadataHandler/LegacyDFSClusterTest.php index 418b6e0aef..e32feed3ef 100644 --- a/tests/lib/IO/IOMetadataHandler/LegacyDFSClusterTest.php +++ b/tests/lib/IO/IOMetadataHandler/LegacyDFSClusterTest.php @@ -132,7 +132,6 @@ public function testLoad(): void $expectedSpiBinaryFile->id = 'prefix/my/file.png'; $expectedSpiBinaryFile->size = 123; $expectedSpiBinaryFile->mtime = new DateTime('@1307155200'); - $expectedSpiBinaryFile->mimeType = 'image/png'; self::assertEquals( $expectedSpiBinaryFile, diff --git a/tests/lib/IO/IOServiceTest.php b/tests/lib/IO/IOServiceTest.php index 9d473927c2..5d865b19b7 100644 --- a/tests/lib/IO/IOServiceTest.php +++ b/tests/lib/IO/IOServiceTest.php @@ -53,39 +53,6 @@ protected function setUp(): void ); } - /** - * Test creating new BinaryCreateStruct from uploaded file. - */ - public function testNewBinaryCreateStructFromUploadedFile() - { - self::markTestSkipped('Test skipped as it seems to depend on php-cgi'); - $uploadTest = $this->getFileUploadTest(); - $result = $uploadTest->run(); // Fails because of unset cgi param and missing php-cgi exe - // Params bellow makes the code execute but fails: - //->run( null, array( 'cgi' => 'php' ) ); - - if ($result->failureCount() > 0) { - self::fail( - 'Failed file upload test, failureCount() > 0: ' . - $this->expandFailureMessages($result->failures()) - ); - } - - if ($result->errorCount() > 0) { - self::fail( - 'Failed file upload test, errorCount() > 0: ' . - $this->expandFailureMessages($result->errors()) - ); - } - - if ($result->skippedCount() > 0) { - self::fail( - 'Failed file upload test, skippedCount() > 0: ' . - $this->expandFailureMessages($result->skipped()) - ); - } - } - public function testNewBinaryCreateStructFromLocalFile() { $file = __FILE__; @@ -121,7 +88,6 @@ public function testCreateBinaryFile(BinaryFileCreateStruct $createStruct) $spiBinaryFile->id = $id; $spiBinaryFile->uri = $id; $spiBinaryFile->size = filesize(__FILE__); - $spiBinaryFile->mimeType = 'text/x-php'; $this->binarydataHandlerMock ->expects(self::once()) @@ -159,7 +125,6 @@ public function testLoadBinaryFile() $spiBinaryFile = new SPIBinaryFile(); $spiBinaryFile->id = $spiId; $spiBinaryFile->size = 12345; - $spiBinaryFile->mimeType = 'application/any'; $spiBinaryFile->uri = $spiId; $this->metadataHandlerMock @@ -220,7 +185,6 @@ public function testLoadBinaryFileByUri() $spiBinaryFile = new SPIBinaryFile(); $spiBinaryFile->id = $spiId; $spiBinaryFile->size = 12345; - $spiBinaryFile->mimeType = 'application/any'; $spiBinaryFile->uri = $spiId; $this->binarydataHandlerMock @@ -320,10 +284,10 @@ public function testGetMimeType(BinaryFile $binaryFile) ->expects(self::once()) ->method('getMimeType') ->with(self::equalTo($this->getPrefixedUri($binaryFile->id))) - ->will(self::returnValue($binaryFile->mimeType)); + ->willReturn('text/x-php'); self::assertEquals( - $binaryFile->mimeType, + 'text/x-php', $this->getIOService()->getMimeType( $binaryFile->id ) @@ -366,10 +330,7 @@ public function testDeleteDirectory() $this->getIOService()->deleteDirectory('some/directory'); } - /** - * @return mixed Whatever deleteBinaryFile returned - */ - public function testDeleteBinaryFileNotFound() + public function testDeleteBinaryFileNotFound(): void { $this->expectException(BinaryFileNotFoundException::class); diff --git a/tests/lib/IO/MetadataHandler/ImageSizeTest.php b/tests/lib/IO/MetadataHandler/ImageSizeTest.php deleted file mode 100644 index 943d431264..0000000000 --- a/tests/lib/IO/MetadataHandler/ImageSizeTest.php +++ /dev/null @@ -1,28 +0,0 @@ - 189, 'height' => 200, 'mime' => 'image/png'], - $metadataHandler->extract($file) - ); - } -} diff --git a/tests/lib/IO/MetadataHandler/ezplogo.png b/tests/lib/IO/MetadataHandler/ezplogo.png deleted file mode 100644 index 74487fba83..0000000000 Binary files a/tests/lib/IO/MetadataHandler/ezplogo.png and /dev/null differ diff --git a/tests/lib/IO/TolerantIOServiceTest.php b/tests/lib/IO/TolerantIOServiceTest.php index dd6107cad8..7c248f2f71 100644 --- a/tests/lib/IO/TolerantIOServiceTest.php +++ b/tests/lib/IO/TolerantIOServiceTest.php @@ -58,7 +58,7 @@ public function testCreateMissingBinaryFile() /** * Overridden to change the expected exception (none). */ - public function testDeleteBinaryFileNotFound() + public function testDeleteBinaryFileNotFound(): void { $this->deleteBinaryFileNotFound(); } diff --git a/tests/lib/MVC/Symfony/Component/Serializer/RegexHostNormalizerTest.php b/tests/lib/MVC/Symfony/Component/Serializer/RegexHostNormalizerTest.php deleted file mode 100644 index 720a300081..0000000000 --- a/tests/lib/MVC/Symfony/Component/Serializer/RegexHostNormalizerTest.php +++ /dev/null @@ -1,53 +0,0 @@ - '/^Foo(.*)/(.*)/', - 'itemNumber' => 2, - ]); - - self::assertEquals( - [ - 'siteAccessesConfiguration' => [ - 'regex' => '/^Foo(.*)/(.*)/', - 'itemNumber' => 2, - ], - ], - $serializer->normalize($matcher) - ); - } - - public function testSupportsNormalization(): void - { - $normalizer = new RegexHostNormalizer(); - - self::assertTrue($normalizer->supportsNormalization($this->createMock(Host::class))); - self::assertFalse($normalizer->supportsNormalization($this->createMock(Matcher::class))); - } -} diff --git a/tests/lib/MVC/Symfony/Component/Serializer/RegexURINormalizerTest.php b/tests/lib/MVC/Symfony/Component/Serializer/RegexURINormalizerTest.php deleted file mode 100644 index 2fa16c2e36..0000000000 --- a/tests/lib/MVC/Symfony/Component/Serializer/RegexURINormalizerTest.php +++ /dev/null @@ -1,53 +0,0 @@ - '/^Foo(.*)/(.*)/', - 'itemNumber' => 2, - ]); - - self::assertEquals( - [ - 'siteAccessesConfiguration' => [ - 'regex' => '/^Foo(.*)/(.*)/', - 'itemNumber' => 2, - ], - ], - $serializer->normalize($matcher) - ); - } - - public function testSupportsNormalization(): void - { - $normalizer = new RegexURINormalizer(); - - self::assertTrue($normalizer->supportsNormalization($this->createMock(URI::class))); - self::assertFalse($normalizer->supportsNormalization($this->createMock(Matcher::class))); - } -} diff --git a/tests/lib/MVC/Symfony/Component/Serializer/SimplifiedRequestNormalizerTest.php b/tests/lib/MVC/Symfony/Component/Serializer/SimplifiedRequestNormalizerTest.php index 4e8491f9b0..da30ae9699 100644 --- a/tests/lib/MVC/Symfony/Component/Serializer/SimplifiedRequestNormalizerTest.php +++ b/tests/lib/MVC/Symfony/Component/Serializer/SimplifiedRequestNormalizerTest.php @@ -14,6 +14,9 @@ final class SimplifiedRequestNormalizerTest extends TestCase { + /** + * @todo Remove together with old syntax for \Ibexa\Core\MVC\Symfony\Routing\SimplifiedRequest::__construct in 6.0.0 + */ public function testNormalize(): void { $request = new SimplifiedRequest([ @@ -46,6 +49,38 @@ public function testNormalize(): void ], $normalizer->normalize($request)); } + public function testNormalizeWithNewConstructor(): void + { + $request = new SimplifiedRequest( + 'http', + 'www.example.com', + 8080, + '/foo', + ['param' => 'value', 'this' => 'that'], + ['pl-PL', 'en-US'], + [ + 'Accept' => 'text/html,application/xhtml+xml', + 'Accept-Encoding' => 'gzip, deflate, br', + 'Accept-Language' => 'pl-PL,pl;q=0.9,en-US;q=0.8,en;q=0.7', + 'User-Agent' => 'Mozilla/5.0', + 'Cookie' => 'eZSESSID21232f297a57a5a743894a0e4a801fc3=mgbs2p6lv936hb5hmdd2cvq6bq', + 'Connection' => 'keep-alive', + ], + ); + + $normalizer = new SimplifiedRequestNormalizer(); + + self::assertEquals([ + 'scheme' => 'http', + 'host' => 'www.example.com', + 'port' => 8080, + 'pathinfo' => '/foo', + 'queryParams' => ['param' => 'value', 'this' => 'that'], + 'headers' => [], + 'languages' => ['pl-PL', 'en-US'], + ], $normalizer->normalize($request)); + } + public function testSupportsNormalization(): void { $normalizer = new SimplifiedRequestNormalizer(); diff --git a/tests/lib/MVC/Symfony/Event/ContentCacheClearEventTest.php b/tests/lib/MVC/Symfony/Event/ContentCacheClearEventTest.php deleted file mode 100644 index 48da36e4b0..0000000000 --- a/tests/lib/MVC/Symfony/Event/ContentCacheClearEventTest.php +++ /dev/null @@ -1,48 +0,0 @@ -getContentInfo()); - } - - public function testAddLocationsToClear() - { - $contentInfo = new ContentInfo(); - $event = new ContentCacheClearEvent($contentInfo); - $locations = [new Location(), new Location()]; - $event->addLocationToClear($locations[0]); - $event->addLocationToClear($locations[1]); - - self::assertSame($locations, $event->getLocationsToClear()); - } - - public function setLocationsToClear() - { - $contentInfo = new ContentInfo(); - $event = new ContentCacheClearEvent($contentInfo); - $initialLocations = [new Location(), new Location()]; - $event->addLocationToClear($initialLocations[0]); - $event->addLocationToClear($initialLocations[1]); - self::assertSame($initialLocations, $event->getLocationsToClear()); - - $otherLocations = [new Location(), new Location()]; - $event->setLocationsToClear($otherLocations); - self::assertSame($otherLocations, $event->getLocationsToClear()); - } -} diff --git a/tests/lib/MVC/Symfony/EventListener/SiteAccessMatchListenerTest.php b/tests/lib/MVC/Symfony/EventListener/SiteAccessMatchListenerTest.php index 35c9c767b3..04e776f1cc 100644 --- a/tests/lib/MVC/Symfony/EventListener/SiteAccessMatchListenerTest.php +++ b/tests/lib/MVC/Symfony/EventListener/SiteAccessMatchListenerTest.php @@ -13,9 +13,7 @@ use Ibexa\Core\MVC\Symfony\Component\Serializer\HostTextNormalizer; use Ibexa\Core\MVC\Symfony\Component\Serializer\MapNormalizer; use Ibexa\Core\MVC\Symfony\Component\Serializer\MatcherDenormalizer; -use Ibexa\Core\MVC\Symfony\Component\Serializer\RegexHostNormalizer; use Ibexa\Core\MVC\Symfony\Component\Serializer\RegexNormalizer; -use Ibexa\Core\MVC\Symfony\Component\Serializer\RegexURINormalizer; use Ibexa\Core\MVC\Symfony\Component\Serializer\SimplifiedRequestNormalizer; use Ibexa\Core\MVC\Symfony\Component\Serializer\SiteAccessNormalizer; use Ibexa\Core\MVC\Symfony\Component\Serializer\URIElementNormalizer; @@ -256,15 +254,13 @@ private function assertRequestHasSiteAccess( ); $simplifiedRequest = new SimplifiedRequest( - [ - 'scheme' => $originalRequest->getScheme(), - 'host' => $originalRequest->getHost(), - 'port' => $originalRequest->getPort(), - 'pathinfo' => $originalRequest->getPathInfo(), - 'queryParams' => $originalRequest->query->all(), - 'languages' => $originalRequest->getLanguages(), - 'headers' => $originalRequest->headers->all(), - ] + $originalRequest->getScheme(), + $originalRequest->getHost(), + $originalRequest->getPort(), + $originalRequest->getPathInfo(), + $originalRequest->query->all(), + $originalRequest->getLanguages(), + $originalRequest->headers->all(), ); $this->saRouter @@ -322,8 +318,6 @@ private function getSerializer(): SerializerInterface new HostElementNormalizer(), new URITextNormalizer(), new HostTextNormalizer(), - new RegexURINormalizer(), - new RegexHostNormalizer(), new RegexNormalizer(), new URIElementNormalizer(), new SimplifiedRequestNormalizer(), diff --git a/tests/lib/MVC/Symfony/Locale/LocaleConverterTest.php b/tests/lib/MVC/Symfony/Locale/LocaleConverterTest.php index 5134d8859a..cee827aa1b 100644 --- a/tests/lib/MVC/Symfony/Locale/LocaleConverterTest.php +++ b/tests/lib/MVC/Symfony/Locale/LocaleConverterTest.php @@ -74,20 +74,6 @@ public function convertToPOSIXProvider(): array ]; } - /** - * @dataProvider convertToRepositoryProvider - */ - public function testConvertToEz(string $posixLocale, ?string $expected): void - { - if ($expected === null) { - $this->logger - ->expects(self::once()) - ->method('warning'); - } - - self::assertSame($expected, $this->localeConverter->convertToEz($posixLocale)); - } - /** * @dataProvider convertToRepositoryProvider */ diff --git a/tests/lib/MVC/Symfony/Routing/SimplifiedRequestTest.php b/tests/lib/MVC/Symfony/Routing/SimplifiedRequestTest.php index 4fb6356ece..0222afb723 100644 --- a/tests/lib/MVC/Symfony/Routing/SimplifiedRequestTest.php +++ b/tests/lib/MVC/Symfony/Routing/SimplifiedRequestTest.php @@ -44,7 +44,7 @@ public function testStrictGetters(): void self::assertSame($languages, $request->getLanguages()); self::assertSame('https', $request->getScheme()); self::assertSame('host.invalid', $request->getHost()); - self::assertSame('8080', $request->getPort()); + self::assertSame(8080, $request->getPort()); self::assertSame('/foo', $request->getPathInfo()); self::assertSame(['param' => 'bar', 'param2' => 'bar2'], $request->getQueryParams()); } diff --git a/tests/lib/MVC/Symfony/SiteAccess/Compound/CompoundAndTest.php b/tests/lib/MVC/Symfony/SiteAccess/Compound/CompoundAndTest.php index 32a33be0a3..8db7c5688b 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/Compound/CompoundAndTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/Compound/CompoundAndTest.php @@ -320,11 +320,11 @@ public function testReverseMatch() public function testSerialize() { $matcher = new LogicalAnd([]); - $matcher->setRequest(new SimplifiedRequest(['pathinfo' => '/foo/bar'])); + $matcher->setRequest(new SimplifiedRequest('http', '', 80, '/foo/bar')); $sa = new SiteAccess('test', 'test', $matcher); $serializedSA1 = serialize($sa); - $matcher->setRequest(new SimplifiedRequest(['pathinfo' => '/foo/bar/baz'])); + $matcher->setRequest(new SimplifiedRequest('http', '', 80, '/foo/bar/baz')); $serializedSA2 = serialize($sa); self::assertSame($serializedSA1, $serializedSA2); diff --git a/tests/lib/MVC/Symfony/SiteAccess/Compound/CompoundOrTest.php b/tests/lib/MVC/Symfony/SiteAccess/Compound/CompoundOrTest.php index 5a5ced475e..dad491048d 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/Compound/CompoundOrTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/Compound/CompoundOrTest.php @@ -322,11 +322,11 @@ public function testReverseMatch2() public function testSerialize() { $matcher = new LogicalOr([]); - $matcher->setRequest(new SimplifiedRequest(['pathinfo' => '/foo/bar'])); + $matcher->setRequest(new SimplifiedRequest('http', '', 80, '/foo/bar')); $sa = new SiteAccess('test', 'test', $matcher); $serializedSA1 = serialize($sa); - $matcher->setRequest(new SimplifiedRequest(['pathinfo' => '/foo/bar/baz'])); + $matcher->setRequest(new SimplifiedRequest('http', '', 80, '/foo/bar/baz')); $serializedSA2 = serialize($sa); self::assertSame($serializedSA1, $serializedSA2); diff --git a/tests/lib/MVC/Symfony/SiteAccess/MatcherSerializationTest.php b/tests/lib/MVC/Symfony/SiteAccess/MatcherSerializationTest.php index 2b875987c3..4a053016fc 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/MatcherSerializationTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/MatcherSerializationTest.php @@ -118,28 +118,12 @@ public function matcherProvider(): iterable ] ), ]; - yield 'RegexHost' => [ - new Matcher\Regex\Host( - [ - 'regex' => 'foo', - 'itemNumber' => 2, - ] - ), - ]; - yield 'RegexURI' => [ - new Matcher\Regex\URI( - [ - 'regex' => 'foo', - 'itemNumber' => 2, - ] - ), - ]; yield 'URIElement' => [ - new Matcher\URIElement( - [ + new Matcher\URIElement( + [ 'elementNumber' => 2, ] - ), + ), ]; yield 'HostElement' => [ new Matcher\HostElement( diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterHostElementTest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterHostElementTest.php index b5f2fcf238..8a7eb4a0af 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterHostElementTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterHostElementTest.php @@ -91,7 +91,7 @@ public function testReverseMatch($siteAccessName, $elementNumber, SimplifiedRequ $matcher->setRequest($request); $result = $matcher->reverseMatch($siteAccessName); self::assertInstanceOf(HostElement::class, $result); - self::assertSame($expectedHost, $result->getRequest()->host); + self::assertSame($expectedHost, $result->getRequest()->getHost()); } public function reverseMatchProvider() @@ -107,18 +107,18 @@ public function reverseMatchProvider() public function testReverseMatchFail() { $matcher = new HostElement([3]); - $matcher->setRequest(new SimplifiedRequest(['host' => 'ibexa.co'])); + $matcher->setRequest(new SimplifiedRequest('http', 'ibexa.co')); self::assertNull($matcher->reverseMatch('foo')); } public function testSerialize() { $matcher = new HostElement([1]); - $matcher->setRequest(new SimplifiedRequest(['host' => 'ibexa.co', 'pathinfo' => '/foo/bar'])); + $matcher->setRequest(new SimplifiedRequest('http', 'ibexa.co', 80, '/foo/bar')); $sa = new SiteAccess('test', 'test', $matcher); $serializedSA1 = serialize($sa); - $matcher->setRequest(new SimplifiedRequest(['host' => 'ibexa.co', 'pathinfo' => '/foo/bar/baz'])); + $matcher->setRequest(new SimplifiedRequest('http', 'ibexa.co', 80, '/foo/bar/baz')); $serializedSA2 = serialize($sa); self::assertSame($serializedSA1, $serializedSA2); diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterHostPortURITest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterHostPortURITest.php index a9cba08db6..7e9d96c9c8 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterHostPortURITest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterHostPortURITest.php @@ -86,7 +86,7 @@ public function matchProvider(): array public function testSetGetRequestMapHost() { $mapKey = 'phoenix-rises.fm'; - $request = new SimplifiedRequest(['host' => $mapKey]); + $request = new SimplifiedRequest('http', $mapKey); $matcher = new Host(['foo' => $mapKey]); $matcher->setRequest($request); self::assertSame($request, $matcher->getRequest()); @@ -107,7 +107,7 @@ public function testReverseMatchHost() 'something_else' => 'another_siteaccess', 'phoenix-rises.fm' => 'ibexa_demo_site', ]; - $request = new SimplifiedRequest(['host' => 'ibexa.co']); + $request = new SimplifiedRequest('http', 'ibexa.co'); $matcher = new Host($config); $matcher->setRequest($request); self::assertSame('ibexa.co', $matcher->getMapKey()); @@ -116,22 +116,22 @@ public function testReverseMatchHost() self::assertInstanceOf(Host::class, $result); self::assertSame($request, $matcher->getRequest()); self::assertSame('phoenix-rises.fm', $result->getMapKey()); - self::assertSame('phoenix-rises.fm', $result->getRequest()->host); + self::assertSame('phoenix-rises.fm', $result->getRequest()->getHost()); } public function testSetGetRequestMapPort() { - $mapKey = '8000'; - $request = new SimplifiedRequest(['port' => $mapKey]); + $mapKey = 8000; + $request = new SimplifiedRequest('http', '', $mapKey); $matcher = new Port(['foo' => $mapKey]); $matcher->setRequest($request); self::assertSame($request, $matcher->getRequest()); - self::assertSame($mapKey, $matcher->getMapKey()); + self::assertSame((string)$mapKey, $matcher->getMapKey()); } public function testReversePortMatchFail() { - $config = ['foo' => '8080']; + $config = ['foo' => 8080]; $matcher = new Port($config); self::assertNull($matcher->reverseMatch('non_existent')); } @@ -143,17 +143,17 @@ public function testReverseMatchPort() '443' => 'another_siteaccess', 8000 => 'ibexa_demo_site', ]; - $request = new SimplifiedRequest(['scheme' => 'http', 'host' => 'ibexa.co']); + $request = new SimplifiedRequest('http', 'ibexa.co'); $matcher = new Port($config); $matcher->setRequest($request); - self::assertSame(80, $matcher->getMapKey()); + self::assertSame('80', $matcher->getMapKey()); $result = $matcher->reverseMatch('ibexa_demo_site'); self::assertInstanceOf(Port::class, $result); self::assertSame($request, $matcher->getRequest()); self::assertSame(8000, $result->getMapKey()); - self::assertSame(8000, $result->getRequest()->port); - self::assertSame('http', $result->getRequest()->scheme); + self::assertSame(8000, $result->getRequest()->getPort()); + self::assertSame('http', $result->getRequest()->getScheme()); } protected function createRouter(): Router diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterHostRegexTest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterHostRegexTest.php deleted file mode 100644 index d7ccdc5350..0000000000 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterHostRegexTest.php +++ /dev/null @@ -1,122 +0,0 @@ - 'foo'], []); - self::assertSame('host:regexp', $matcher->getName()); - } - - /** - * @return \Ibexa\Core\MVC\Symfony\SiteAccess\Router - */ - protected function createRouter(): Router - { - return new Router( - $this->matcherBuilder, - $this->createMock(LoggerInterface::class), - 'default_sa', - [ - 'Regex\\Host' => [ - 'regex' => '^(\\w+_sa)$', - ], - 'Map\\URI' => [ - 'first_sa' => 'first_sa', - 'second_sa' => 'second_sa', - ], - 'Map\\Host' => [ - 'first_sa' => 'first_sa', - 'first_siteaccess' => 'first_sa', - ], - ], - $this->siteAccessProvider - ); - } - - /** - * @return \Ibexa\Tests\Core\MVC\Symfony\SiteAccess\SiteAccessSetting[] - */ - public function getSiteAccessProviderSettings(): array - { - return [ - new SiteAccessSetting('first_sa', true), - new SiteAccessSetting('second_sa', true), - new SiteAccessSetting('third_sa', true), - new SiteAccessSetting('fourth_sa', true), - new SiteAccessSetting('fifth_sa', true), - new SiteAccessSetting('example', true), - new SiteAccessSetting(self::DEFAULT_SA_NAME, true), - ]; - } -} diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterHostTextTest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterHostTextTest.php index 1c86354a6f..c185d744ef 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterHostTextTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterHostTextTest.php @@ -86,13 +86,13 @@ public function testReverseMatch() ] ); - $matcher->setRequest(new SimplifiedRequest(['host' => 'www.my_siteaccess.com'])); + $matcher->setRequest(new SimplifiedRequest('http', 'www.my_siteaccess.com')); $result = $matcher->reverseMatch('foobar'); self::assertInstanceOf(HostTextMatcher::class, $result); $request = $result->getRequest(); self::assertInstanceOf(SimplifiedRequest::class, $request); - self::assertSame('www.foobar.com', $request->host); + self::assertSame('www.foobar.com', $request->getHost()); } protected function createRouter(): Router diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterMapURITest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterMapURITest.php index 13e870188c..a78712c5cc 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterMapURITest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterMapURITest.php @@ -22,7 +22,7 @@ class RouterMapURITest extends TestCase */ public function testSetGetRequest($config, $pathinfo, $expectedMapKey) { - $request = new SimplifiedRequest(['pathinfo' => $pathinfo]); + $request = new SimplifiedRequest('http', '', 80, $pathinfo); $matcher = new URIMapMatcher($config); $matcher->setRequest($request); self::assertSame($request, $matcher->getRequest()); @@ -39,7 +39,7 @@ public function testAnalyseURI($uri, $expectedFixedUpURI) { $matcher = new URIMapMatcher([]); $matcher->setRequest( - new SimplifiedRequest(['pathinfo' => $uri]) + new SimplifiedRequest('http', '', 80, $uri) ); self::assertSame($expectedFixedUpURI, $matcher->analyseURI($uri)); // Unserialized matcher should have the same behavior @@ -57,7 +57,7 @@ public function testAnalyseLink($fullUri, $linkUri) { $matcher = new URIMapMatcher([]); $matcher->setRequest( - new SimplifiedRequest(['pathinfo' => $fullUri]) + new SimplifiedRequest('http', '', 80, $fullUri) ); self::assertSame($fullUri, $matcher->analyseLink($linkUri)); // Unserialized matcher should have the same behavior @@ -100,7 +100,7 @@ public function testReverseMatch() 'something_else' => 'another_siteaccess', 'toutouyoutou' => 'ibexa_demo_site', ]; - $request = new SimplifiedRequest(['pathinfo' => '/foo']); + $request = new SimplifiedRequest('http', '', 80, '/foo'); $matcher = new URIMapMatcher($config); $matcher->setRequest($request); @@ -108,6 +108,6 @@ public function testReverseMatch() self::assertInstanceOf(URIMapMatcher::class, $result); self::assertSame($request, $matcher->getRequest()); self::assertSame('toutouyoutou', $result->getMapKey()); - self::assertSame('/toutouyoutou/foo', $result->getRequest()->pathinfo); + self::assertSame('/toutouyoutou/foo', $result->getRequest()->getPathInfo()); } } diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterTest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterTest.php index 471ac520ce..e18e03a063 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterTest.php @@ -203,7 +203,8 @@ public function testMatchByName() $router->setSiteAccess(new SiteAccess('test', 'test', $matcherInitialSA)); $matcherInitialSA ->expects(self::once()) - ->method('analyseURI'); + ->method('analyseURI') + ->willReturn(''); $matcher = $this->createMock(VersatileMatcher::class); $matcherBuilder diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterURIElement2Test.php b/tests/lib/MVC/Symfony/SiteAccess/RouterURIElement2Test.php index a13cf4ac7c..b5367500ba 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterURIElement2Test.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterURIElement2Test.php @@ -78,7 +78,7 @@ public function testAnalyseURI($level, $uri, $expectedFixedUpURI) { $matcher = new URIElementMatcher([$level]); $matcher->setRequest( - new SimplifiedRequest(['pathinfo' => $uri]) + new SimplifiedRequest('http', '', 80, $uri) ); self::assertSame($expectedFixedUpURI, $matcher->analyseURI($uri)); } @@ -94,7 +94,7 @@ public function testAnalyseURILevelAsInt($level, $uri, $expectedFixedUpURI) { $matcher = new URIElementMatcher($level); $matcher->setRequest( - new SimplifiedRequest(['pathinfo' => $uri]) + new SimplifiedRequest('http', '', 80, $uri) ); self::assertSame($expectedFixedUpURI, $matcher->analyseURI($uri)); } @@ -110,7 +110,7 @@ public function testAnalyseLink($level, $fullUri, $linkUri) { $matcher = new URIElementMatcher([$level]); $matcher->setRequest( - new SimplifiedRequest(['pathinfo' => $fullUri]) + new SimplifiedRequest('http', '', 80, $fullUri) ); self::assertSame($fullUri, $matcher->analyseLink($linkUri)); } @@ -140,11 +140,11 @@ public function testReverseMatch($siteAccessName, $originalPathinfo) { $expectedSiteAccessPath = str_replace('_', '/', $siteAccessName); $matcher = new URIElementMatcher([2]); - $matcher->setRequest(new SimplifiedRequest(['pathinfo' => $originalPathinfo])); + $matcher->setRequest(new SimplifiedRequest('http', '', 80, $originalPathinfo)); $result = $matcher->reverseMatch($siteAccessName); self::assertInstanceOf(URIElement::class, $result); - self::assertSame("/{$expectedSiteAccessPath}{$originalPathinfo}", $result->getRequest()->pathinfo); + self::assertSame("/{$expectedSiteAccessPath}{$originalPathinfo}", $result->getRequest()->getPathInfo()); self::assertSame("/$expectedSiteAccessPath/some/linked/uri", $result->analyseLink('/some/linked/uri')); self::assertSame('/foo/bar/baz', $result->analyseURI("/$expectedSiteAccessPath/foo/bar/baz")); } @@ -160,18 +160,18 @@ public function reverseMatchProvider() public function testReverseMatchFail() { $matcher = new URIElementMatcher([2]); - $matcher->setRequest(new SimplifiedRequest(['pathinfo' => '/my/siteaccess/foo/bar'])); + $matcher->setRequest(new SimplifiedRequest('http', '', 80, '/my/siteaccess/foo/bar')); self::assertNull($matcher->reverseMatch('another_siteaccess_again_dont_tell_me')); } public function testSerialize() { $matcher = new URIElementMatcher([2]); - $matcher->setRequest(new SimplifiedRequest(['pathinfo' => '/foo/bar'])); + $matcher->setRequest(new SimplifiedRequest('http', '', 80, '/foo/bar')); $sa = new SiteAccess('test', 'test', $matcher); $serializedSA1 = serialize($sa); - $matcher->setRequest(new SimplifiedRequest(['pathinfo' => '/foo/bar/baz'])); + $matcher->setRequest(new SimplifiedRequest('http', '', 80, '/foo/bar/baz')); $serializedSA2 = serialize($sa); self::assertSame($serializedSA1, $serializedSA2); diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterURIElementTest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterURIElementTest.php index 3f93c3ee79..070ac79390 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterURIElementTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterURIElementTest.php @@ -83,7 +83,7 @@ public function testAnalyseURI($uri, $expectedFixedUpURI) { $matcher = new URIElementMatcher([1]); $matcher->setRequest( - new SimplifiedRequest(['pathinfo' => $uri]) + new SimplifiedRequest('http', '', 80, $uri) ); self::assertSame($expectedFixedUpURI, $matcher->analyseURI($uri)); } @@ -98,7 +98,7 @@ public function testAnalyseLink($fullUri, $linkUri) { $matcher = new URIElementMatcher([1]); $matcher->setRequest( - new SimplifiedRequest(['pathinfo' => $fullUri]) + new SimplifiedRequest('http', '', 80, $fullUri) ); self::assertSame($fullUri, $matcher->analyseLink($linkUri)); } @@ -117,10 +117,10 @@ public function analyseProvider() public function testReverseMatch($siteAccessName, $originalPathinfo) { $matcher = new URIElementMatcher([1]); - $matcher->setRequest(new SimplifiedRequest(['pathinfo' => $originalPathinfo])); + $matcher->setRequest(new SimplifiedRequest('http', '', 80, $originalPathinfo)); $result = $matcher->reverseMatch($siteAccessName); self::assertInstanceOf(URIElement::class, $result); - self::assertSame("/{$siteAccessName}{$originalPathinfo}", $result->getRequest()->pathinfo); + self::assertSame("/{$siteAccessName}{$originalPathinfo}", $result->getRequest()->getPathInfo()); self::assertSame("/$siteAccessName/some/linked/uri", $result->analyseLink('/some/linked/uri')); self::assertSame('/foo/bar/baz', $result->analyseURI("/$siteAccessName/foo/bar/baz")); } @@ -139,11 +139,11 @@ public function reverseMatchProvider() public function testSerialize() { $matcher = new URIElementMatcher([1]); - $matcher->setRequest(new SimplifiedRequest(['pathinfo' => '/foo/bar'])); + $matcher->setRequest(new SimplifiedRequest('http', '', 80, '/foo/bar')); $sa = new SiteAccess('test', 'test', $matcher); $serializedSA1 = serialize($sa); - $matcher->setRequest(new SimplifiedRequest(['pathinfo' => '/foo/bar/baz'])); + $matcher->setRequest(new SimplifiedRequest('http', '', 80, '/foo/bar/baz')); $serializedSA2 = serialize($sa); self::assertSame($serializedSA1, $serializedSA2); diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterURIRegexTest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterURIRegexTest.php deleted file mode 100644 index e80ca50716..0000000000 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterURIRegexTest.php +++ /dev/null @@ -1,138 +0,0 @@ -getName()); - } - - public function testSerialize() - { - $matcher = new RegexMatcher( - [ - 'regex' => '^/foo(\\w+)bar', - 'itemNumber' => 2, - ] - ); - $matcher->setRequest(new SimplifiedRequest(['pathinfo' => '/foo/bar'])); - $sa = new SiteAccess('test', 'test', $matcher); - $serializedSA1 = serialize($sa); - - $matcher->setRequest(new SimplifiedRequest(['pathinfo' => '/foo/bar/baz'])); - $serializedSA2 = serialize($sa); - - self::assertSame($serializedSA1, $serializedSA2); - } - - protected function createRouter(): Router - { - return new Router( - $this->matcherBuilder, - $this->createMock(LoggerInterface::class), - 'default_sa', - [ - 'Regex\\URI' => [ - 'regex' => '^/foo(\\w+)bar', - ], - 'Map\\URI' => [ - 'first_sa' => 'first_sa', - 'second_sa' => 'second_sa', - ], - 'Map\\Host' => [ - 'first_sa' => 'first_sa', - 'first_siteaccess' => 'first_sa', - ], - ], - $this->siteAccessProvider - ); - } - - /** - * @return \Ibexa\Tests\Core\MVC\Symfony\SiteAccess\SiteAccessSetting[] - */ - public function getSiteAccessProviderSettings(): array - { - return [ - new SiteAccessSetting('first_sa', true), - new SiteAccessSetting('second_sa', true), - new SiteAccessSetting('third_sa', true), - new SiteAccessSetting('fourth_sa', true), - new SiteAccessSetting('fifth_sa', true), - new SiteAccessSetting('test', true), - new SiteAccessSetting(self::DEFAULT_SA_NAME, true), - ]; - } -} diff --git a/tests/lib/MVC/Symfony/SiteAccess/RouterURITextTest.php b/tests/lib/MVC/Symfony/SiteAccess/RouterURITextTest.php index 4b16e9efc3..bcc90d3241 100644 --- a/tests/lib/MVC/Symfony/SiteAccess/RouterURITextTest.php +++ b/tests/lib/MVC/Symfony/SiteAccess/RouterURITextTest.php @@ -118,13 +118,13 @@ public function testReverseMatch() 'suffix' => 'bar', ] ); - $matcher->setRequest(new SimplifiedRequest(['pathinfo' => $semanticURI])); + $matcher->setRequest(new SimplifiedRequest('http', '', 80, $semanticURI)); $result = $matcher->reverseMatch('something'); self::assertInstanceOf(URIText::class, $result); $request = $result->getRequest(); self::assertInstanceOf(SimplifiedRequest::class, $request); - self::assertSame("/foosomethingbar{$semanticURI}", $request->pathinfo); + self::assertSame("/foosomethingbar{$semanticURI}", $request->getPathInfo()); } protected function createRouter(): Router diff --git a/tests/lib/MVC/Symfony/View/ViewManagerTest.php b/tests/lib/MVC/Symfony/View/ViewManagerTest.php index 717b0c4caf..0d5935bb4a 100644 --- a/tests/lib/MVC/Symfony/View/ViewManagerTest.php +++ b/tests/lib/MVC/Symfony/View/ViewManagerTest.php @@ -14,7 +14,6 @@ use Ibexa\Core\MVC\Symfony\View\Configurator; use Ibexa\Core\MVC\Symfony\View\Manager; use Ibexa\Core\MVC\Symfony\View\View; -use Ibexa\Core\MVC\Symfony\View\ViewProvider; use Ibexa\Core\Repository\ContentService; use Ibexa\Core\Repository\Values\Content\Content; use Ibexa\Core\Repository\Values\Content\Location; @@ -66,46 +65,6 @@ protected function setUp(): void ); } - public function testAddContentViewProvider() - { - self::assertSame([], $this->viewManager->getAllContentViewProviders()); - $viewProvider = $this->createMock(ViewProvider::class); - $this->viewManager->addContentViewProvider($viewProvider); - self::assertSame([$viewProvider], $this->viewManager->getAllContentViewProviders()); - } - - public function testAddLocationViewProvider() - { - self::assertSame([], $this->viewManager->getAllLocationViewProviders()); - $viewProvider = $this->createMock(ViewProvider::class); - $this->viewManager->addLocationViewProvider($viewProvider); - self::assertSame([$viewProvider], $this->viewManager->getAllLocationViewProviders()); - } - - public function testContentViewProvidersPriority() - { - [$high, $medium, $low] = $this->createContentViewProviderMocks(); - $this->viewManager->addContentViewProvider($medium, 33); - $this->viewManager->addContentViewProvider($high, 100); - $this->viewManager->addContentViewProvider($low, -100); - self::assertSame( - [$high, $medium, $low], - $this->viewManager->getAllContentViewProviders() - ); - } - - public function testLocationViewProvidersPriority() - { - [$high, $medium, $low] = $this->createLocationViewProviderMocks(); - $this->viewManager->addLocationViewProvider($medium, 33); - $this->viewManager->addLocationViewProvider($high, 100); - $this->viewManager->addLocationViewProvider($low, -100); - self::assertSame( - [$high, $medium, $low], - $this->viewManager->getAllLocationViewProviders() - ); - } - public function testRenderContent() { $content = new Content( @@ -325,22 +284,4 @@ static function (View $view) use ($closure) { self::assertSame($expectedTemplateResult, $templateResult); } - - private function createContentViewProviderMocks() - { - return [ - $this->createMock(ViewProvider::class), - $this->createMock(ViewProvider::class), - $this->createMock(ViewProvider::class), - ]; - } - - private function createLocationViewProviderMocks() - { - return [ - $this->createMock(ViewProvider::class), - $this->createMock(ViewProvider::class), - $this->createMock(ViewProvider::class), - ]; - } } diff --git a/tests/lib/Persistence/Legacy/Content/StorageHandlerTest.php b/tests/lib/Persistence/Legacy/Content/StorageHandlerTest.php index 09ff6c4359..3e64ca38a9 100644 --- a/tests/lib/Persistence/Legacy/Content/StorageHandlerTest.php +++ b/tests/lib/Persistence/Legacy/Content/StorageHandlerTest.php @@ -39,8 +39,7 @@ public function testStoreFieldData(): void ->method('storeFieldData') ->with( self::isInstanceOf(VersionInfo::class), - self::isInstanceOf(Field::class), - self::equalTo($this->getContextMock()) + self::isInstanceOf(Field::class) ); $storageRegistryMock->expects(self::once()) @@ -68,8 +67,7 @@ public function testGetFieldDataAvailable(): void ->method('getFieldData') ->with( self::isInstanceOf(VersionInfo::class), - self::isInstanceOf(Field::class), - self::equalTo($this->getContextMock()) + self::isInstanceOf(Field::class) ); $storageRegistryMock->expects(self::once()) @@ -144,8 +142,7 @@ public function testDeleteFieldData(): void ->method('deleteFieldData') ->with( self::isInstanceOf(VersionInfo::class), - self::equalTo([1, 2, 3]), - self::equalTo($this->getContextMock()) + self::equalTo([1, 2, 3]) ); $storageRegistryMock->expects(self::once()) diff --git a/tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php b/tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php index a4a67a147a..3f5f8f2766 100644 --- a/tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php +++ b/tests/lib/Repository/Decorator/ContentServiceDecoratorTest.php @@ -12,11 +12,13 @@ use Ibexa\Contracts\Core\Repository\Decorator\ContentServiceDecorator; use Ibexa\Contracts\Core\Repository\Values\Content\Content; use Ibexa\Contracts\Core\Repository\Values\Content\ContentCreateStruct; +use Ibexa\Contracts\Core\Repository\Values\Content\ContentDraftList; use Ibexa\Contracts\Core\Repository\Values\Content\ContentInfo; use Ibexa\Contracts\Core\Repository\Values\Content\ContentMetadataUpdateStruct; use Ibexa\Contracts\Core\Repository\Values\Content\ContentUpdateStruct; use Ibexa\Contracts\Core\Repository\Values\Content\LocationCreateStruct; use Ibexa\Contracts\Core\Repository\Values\Content\Relation; +use Ibexa\Contracts\Core\Repository\Values\Content\RelationList; use Ibexa\Contracts\Core\Repository\Values\Content\VersionInfo; use Ibexa\Contracts\Core\Repository\Values\ContentType\ContentType; use Ibexa\Contracts\Core\Repository\Values\User\User; @@ -30,13 +32,13 @@ class ContentServiceDecoratorTest extends TestCase private const EXAMPLE_CONTENT_REMOTE_ID = 'example'; private const EXAMPLE_VERSION_NO = 1; - protected function createDecorator(MockObject $service): ContentService + protected function createDecorator(ContentService&MockObject $service): ContentService { return new class($service) extends ContentServiceDecorator { }; } - protected function createServiceMock(): MockObject + protected function createServiceMock(): ContentService&MockObject { return $this->createMock(ContentService::class); } @@ -248,16 +250,16 @@ public function testCreateContentDraftDecorator() $decoratedService->createContentDraft(...$parameters); } - public function testLoadContentDraftsDecorator() + public function testLoadContentDraftListDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); $parameters = [$this->createMock(User::class)]; - $serviceMock->expects(self::once())->method('loadContentDrafts')->with(...$parameters)->willReturn([]); + $serviceMock->expects(self::once())->method('loadContentDraftList')->with(...$parameters)->willReturn(new ContentDraftList()); - $decoratedService->loadContentDrafts(...$parameters); + $decoratedService->loadContentDraftList(...$parameters); } public function testUpdateContentDecorator() @@ -327,16 +329,16 @@ public function testCopyContentDecorator() $decoratedService->copyContent(...$parameters); } - public function testLoadRelationsDecorator() + public function testLoadRelationListDecorator(): void { $serviceMock = $this->createServiceMock(); $decoratedService = $this->createDecorator($serviceMock); $parameters = [$this->createMock(VersionInfo::class)]; - $serviceMock->expects(self::once())->method('loadRelations')->with(...$parameters)->willReturn([]); + $serviceMock->expects(self::once())->method('loadRelationList')->with(...$parameters)->willReturn(new RelationList()); - $decoratedService->loadRelations(...$parameters); + $decoratedService->loadRelationList(...$parameters); } public function testLoadReverseRelationsDecorator() diff --git a/tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php b/tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php deleted file mode 100644 index 529e036ae3..0000000000 --- a/tests/lib/Repository/Service/Mock/PermissionsCriterionHandlerTest.php +++ /dev/null @@ -1,399 +0,0 @@ -getPermissionsCriterionHandlerMock(['getPermissionsCriterion']); - $criterionMock = $this->createMock(Criterion::class); - - $handler - ->expects(self::once()) - ->method('getPermissionsCriterion') - ->will(self::returnValue($permissionsCriterion)); - - /* @var \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterionMock */ - $result = $handler->addPermissionsCriterion($criterionMock); - - self::assertSame($permissionsCriterion, $result); - } - - public function providerForTestAddPermissionsCriterion() - { - $criterionMock = $this->createMock(Criterion::class); - - return [ - [ - $criterionMock, - new Criterion\LogicalAnd([]), - new Criterion\LogicalAnd([$criterionMock]), - ], - [ - $criterionMock, - $criterionMock, - new Criterion\LogicalAnd([$criterionMock, $criterionMock]), - ], - ]; - } - - /** - * Test for the addPermissionsCriterion() method. - * - * @dataProvider providerForTestAddPermissionsCriterion - */ - public function testAddPermissionsCriterion($permissionsCriterionMock, $givenCriterion, $expectedCriterion) - { - $handler = $this->getPermissionsCriterionHandlerMock(['getPermissionsCriterion']); - $handler - ->expects(self::once()) - ->method('getPermissionsCriterion') - ->will(self::returnValue($permissionsCriterionMock)); - - /* @var \Ibexa\Contracts\Core\Repository\Values\Content\Query\Criterion $criterionMock */ - $result = $handler->addPermissionsCriterion($givenCriterion); - - self::assertTrue($result); - self::assertEquals($expectedCriterion, $givenCriterion); - } - - public function providerForTestGetPermissionsCriterion() - { - $criterionMock = $this->createMock(Criterion::class); - $limitationMock = $this - ->getMockBuilder(APILimitation::class) - ->getMockForAbstractClass(); - $limitationMock - ->expects(self::any()) - ->method('getIdentifier') - ->will(self::returnValue('limitationIdentifier')); - - $policy1 = new Policy(['limitations' => [$limitationMock]]); - $policy2 = new Policy(['limitations' => [$limitationMock, $limitationMock]]); - - return [ - [ - $criterionMock, - 1, - [ - [ - 'limitation' => null, - 'policies' => [$policy1], - ], - ], - $criterionMock, - ], - [ - $criterionMock, - 2, - [ - [ - 'limitation' => null, - 'policies' => [$policy1, $policy1], - ], - ], - new Criterion\LogicalOr([$criterionMock, $criterionMock]), - ], - [ - $criterionMock, - 0, - [ - [ - 'limitation' => null, - 'policies' => [new Policy(['limitations' => []]), $policy1], - ], - ], - false, - ], - [ - $criterionMock, - 2, - [ - [ - 'limitation' => null, - 'policies' => [$policy2], - ], - ], - new Criterion\LogicalAnd([$criterionMock, $criterionMock]), - ], - [ - $criterionMock, - 3, - [ - [ - 'limitation' => null, - 'policies' => [$policy1, $policy2], - ], - ], - new Criterion\LogicalOr( - [ - $criterionMock, - new Criterion\LogicalAnd([$criterionMock, $criterionMock]), - ] - ), - ], - [ - $criterionMock, - 2, - [ - [ - 'limitation' => null, - 'policies' => [$policy1], - ], - [ - 'limitation' => null, - 'policies' => [$policy1], - ], - ], - new Criterion\LogicalOr([$criterionMock, $criterionMock]), - ], - [ - $criterionMock, - 3, - [ - [ - 'limitation' => null, - 'policies' => [$policy1], - ], - [ - 'limitation' => null, - 'policies' => [$policy1, $policy1], - ], - ], - new Criterion\LogicalOr([$criterionMock, $criterionMock, $criterionMock]), - ], - [ - $criterionMock, - 3, - [ - [ - 'limitation' => null, - 'policies' => [$policy2], - ], - [ - 'limitation' => null, - 'policies' => [$policy1], - ], - ], - new Criterion\LogicalOr( - [ - new Criterion\LogicalAnd([$criterionMock, $criterionMock]), - $criterionMock, - ] - ), - ], - [ - $criterionMock, - 2, - [ - [ - 'limitation' => $limitationMock, - 'policies' => [$policy1], - ], - ], - new Criterion\LogicalAnd([$criterionMock, $criterionMock]), - ], - [ - $criterionMock, - 4, - [ - [ - 'limitation' => $limitationMock, - 'policies' => [$policy1], - ], - [ - 'limitation' => $limitationMock, - 'policies' => [$policy1], - ], - ], - new Criterion\LogicalOr( - [ - new Criterion\LogicalAnd([$criterionMock, $criterionMock]), - new Criterion\LogicalAnd([$criterionMock, $criterionMock]), - ] - ), - ], - [ - $criterionMock, - 1, - [ - [ - 'limitation' => $limitationMock, - 'policies' => [new Policy(['limitations' => []])], - ], - ], - $criterionMock, - ], - [ - $criterionMock, - 2, - [ - [ - 'limitation' => $limitationMock, - 'policies' => [new Policy(['limitations' => []])], - ], - [ - 'limitation' => $limitationMock, - 'policies' => [new Policy(['limitations' => []])], - ], - ], - new Criterion\LogicalOr([$criterionMock, $criterionMock]), - ], - ]; - } - - protected function mockServices($criterionMock, $limitationCount, $permissionSets) - { - $userMock = $this->createMock(User::class); - $limitationTypeMock = $this->createMock(Type::class); - $limitationServiceMock = $this->getLimitationServiceMock(); - $permissionResolverMock = $this->getPermissionResolverMock( - [ - 'hasAccess', - 'getCurrentUserReference', - ] - ); - - $limitationTypeMock - ->expects(self::any()) - ->method('getCriterion') - ->with( - self::isInstanceOf(APILimitation::class), - self::equalTo($userMock) - ) - ->will(self::returnValue($criterionMock)); - - $limitationServiceMock - ->expects(self::exactly($limitationCount)) - ->method('getLimitationType') - ->with(self::equalTo('limitationIdentifier')) - ->will(self::returnValue($limitationTypeMock)); - - $permissionResolverMock - ->expects(self::once()) - ->method('hasAccess') - ->with(self::equalTo('content'), self::equalTo('read')) - ->will(self::returnValue($permissionSets)); - - $permissionResolverMock - ->expects(self::once()) - ->method('getCurrentUserReference') - ->will(self::returnValue($userMock)); - } - - /** - * Test for the getPermissionsCriterion() method. - * - * @dataProvider providerForTestGetPermissionsCriterion - */ - public function testGetPermissionsCriterion( - $criterionMock, - $limitationCount, - $permissionSets, - $expectedCriterion - ) { - $this->mockServices($criterionMock, $limitationCount, $permissionSets); - $handler = $this->getPermissionsCriterionHandlerMock(null); - - $permissionsCriterion = $handler->getPermissionsCriterion(); - - self::assertEquals($expectedCriterion, $permissionsCriterion); - } - - public function providerForTestGetPermissionsCriterionBooleanPermissionSets() - { - return [ - [true], - [false], - ]; - } - - /** - * Test for the getPermissionsCriterion() method. - * - * @dataProvider providerForTestGetPermissionsCriterionBooleanPermissionSets - */ - public function testGetPermissionsCriterionBooleanPermissionSets($permissionSets) - { - $permissionResolverMock = $this->getPermissionResolverMock(['hasAccess']); - $permissionResolverMock - ->expects(self::once()) - ->method('hasAccess') - ->with(self::equalTo('testModule'), self::equalTo('testFunction')) - ->will(self::returnValue($permissionSets)); - $handler = $this->getPermissionsCriterionHandlerMock(null); - - $permissionsCriterion = $handler->getPermissionsCriterion('testModule', 'testFunction'); - - self::assertEquals($permissionSets, $permissionsCriterion); - } - - /** - * Returns the PermissionsCriterionHandler to test with $methods mocked. - * - * @param string[]|null $methods - * - * @return \PHPUnit\Framework\MockObject\MockObject|\Ibexa\Core\Repository\PermissionsCriterionHandler - */ - protected function getPermissionsCriterionHandlerMock($methods = []) - { - return $this - ->getMockBuilder(PermissionsCriterionHandler::class) - ->setMethods($methods) - ->setConstructorArgs( - [ - $this->getPermissionResolverMock(), - $this->getLimitationServiceMock(), - ] - ) - ->getMock(); - } - - protected $permissionResolverMock; - - protected function getPermissionResolverMock($methods = []) - { - if ($this->permissionResolverMock === null) { - $this->permissionResolverMock = $this - ->getMockBuilder(PermissionResolver::class) - ->setMethods($methods) - ->disableOriginalConstructor() - ->getMockForAbstractClass(); - } - - return $this->permissionResolverMock; - } -} diff --git a/tests/lib/Repository/SiteAccessAware/ContentServiceTest.php b/tests/lib/Repository/SiteAccessAware/ContentServiceTest.php index 0990be3e1f..14059383a1 100644 --- a/tests/lib/Repository/SiteAccessAware/ContentServiceTest.php +++ b/tests/lib/Repository/SiteAccessAware/ContentServiceTest.php @@ -84,9 +84,6 @@ public function providerForPassTroughMethods(): array ['countContentDrafts', [], 0], ['countContentDrafts', [$user], 0], - ['loadContentDrafts', [], [$content]], - ['loadContentDrafts', [$user], [$content]], - ['loadContentDraftList', [], new ContentDraftList()], ['loadContentDraftList', [$user], new ContentDraftList()], ['loadContentDraftList', [$user, 1], new ContentDraftList()], @@ -103,7 +100,6 @@ public function providerForPassTroughMethods(): array ['copyContent', [$contentInfo, $locationCreateStruct], $content], ['copyContent', [$contentInfo, $locationCreateStruct, $versionInfo], $content], - ['loadRelations', [$versionInfo], [$relation]], ['loadRelationList', [$versionInfo], $relationList], ['countRelations', [$versionInfo], 0],