Skip to content

Commit

Permalink
Pimcore 6 Compatibility (#30)
Browse files Browse the repository at this point in the history
* adjust tests for P6

* adjust tests for P6

* adjust tests for P6

* adjust tests for P6

* fix error page and default language

* fix travis
  • Loading branch information
solverat authored Jul 18, 2019
1 parent aab6c68 commit 6681cb6
Show file tree
Hide file tree
Showing 9 changed files with 147 additions and 238 deletions.
59 changes: 13 additions & 46 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,73 +20,40 @@ env:
- PIMCORE_TEST_DB_DSN="mysql://root@localhost/dachcom_bundle_test"
- SYMFONY_DEPRECATIONS_HELPER=weak
- DACHCOM_TEST_SECTION=codeception
- SYMFONY_VERSION=^4.0
matrix:
include:
- name: "PHPStan Static Analysis (Pimcore 5.8.x, PHP 7.3)"
- name: "PHPStan Static Analysis (Pimcore 6.0.x, Symfony ^4.0, PHP 7.3)"
sudo: required
php: 7.3
env:
- PIMCORE_SKELETON_BRANCH="tags/v1.3.0"
- PIMCORE_SKELETON_BRANCH="tags/v2.0.0"
- DACHCOM_TEST_SECTION=phpstan
- name: "PHP ECS (Pimcore 5.8.x, PHP 7.3)"
- name: "PHP ECS (Pimcore 6.0.x, Symfony ^4.0, PHP 7.3)"
sudo: required
php: 7.3
env:
- PIMCORE_SKELETON_BRANCH="tags/v1.3.0"
- PIMCORE_SKELETON_BRANCH="tags/v2.0.0"
- DACHCOM_TEST_SECTION=ecs
- name: "Codeception Tests (Pimcore 5.4.x, PHP 7.2)"
- name: "Codeception Tests (Pimcore 6.0.x, Symfony ^4.0, PHP 7.2)"
sudo: required
php: 7.2
env:
- PIMCORE_SKELETON_BRANCH="tags/v1.0.4"
- name: "Codeception Tests (Pimcore 5.4.x, PHP 7.3)"
- PIMCORE_SKELETON_BRANCH="tags/v2.0.0"
- name: "Codeception Tests (Pimcore 6.0.x, Symfony ^4.0, PHP 7.3)"
sudo: required
php: 7.3
env:
- PIMCORE_SKELETON_BRANCH="tags/v1.0.4"
- name: "Codeception Tests (Pimcore 5.5.x, PHP 7.2)"
sudo: required
php: 7.2
env:
- PIMCORE_SKELETON_BRANCH="tags/v1.0.5"
- name: "Codeception Tests (Pimcore 5.5.x, PHP 7.3)"
sudo: required
php: 7.3
env:
- PIMCORE_SKELETON_BRANCH="tags/v1.0.5"
- name: "Codeception Tests (Pimcore 5.6.x, PHP 7.2)"
sudo: required
php: 7.2
env:
- PIMCORE_SKELETON_BRANCH="tags/v1.1.0"
- name: "Codeception Tests (Pimcore 5.6.x, PHP 7.3)"
sudo: required
php: 7.3
env:
- PIMCORE_SKELETON_BRANCH="tags/v1.1.0"
- name: "Codeception Tests (Pimcore 5.7.x, PHP 7.2)"
sudo: required
php: 7.2
env:
- PIMCORE_SKELETON_BRANCH="tags/v1.2.0"
- name: "Codeception Tests (Pimcore 5.7.x, PHP 7.3)"
sudo: required
php: 7.3
env:
- PIMCORE_SKELETON_BRANCH="tags/v1.2.0"
- name: "Codeception Tests (Pimcore 5.8.x, PHP 7.2)"
sudo: required
php: 7.2
env:
- PIMCORE_SKELETON_BRANCH="tags/v1.3.0"
- name: "Codeception Tests (Pimcore 5.8.x, PHP 7.3)"
- PIMCORE_SKELETON_BRANCH="tags/v2.0.0"
- name: "Codeception Tests (Pimcore 6.0.x, Symfony ^3.4, PHP 7.3)"
sudo: required
php: 7.3
env:
- PIMCORE_SKELETON_BRANCH="tags/v1.3.0"
- SYMFONY_VERSION=^3.4
- PIMCORE_SKELETON_BRANCH="tags/v2.0.0"
allow_failures:
- env:
- PIMCORE_SKELETON_BRANCH="tags/v1.3.0"
- PIMCORE_SKELETON_BRANCH="tags/v2.0.0"
- DACHCOM_TEST_SECTION=ecs
fast_finish: true

Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Pimcore 5 - i18n Manager
# Pimcore - i18n Manager

[![Software License](https://img.shields.io/badge/license-GPLv3-brightgreen.svg?style=flat-square)](LICENSE.md)
[![Latest Release](https://img.shields.io/packagist/v/dachcom-digital/i18n.svg?style=flat-square)](https://packagist.org/packages/dachcom-digital/i18n)
Expand All @@ -7,9 +7,6 @@

![i18n](https://user-images.githubusercontent.com/700119/27761666-f3ed6746-5e60-11e7-955a-3030453c68ff.jpg)

## Requirements
* Pimcore >= 5.4.0

## Introduction
Pimcore already comes with some great features to build internationalized websites. But there are some gaps we have to handle by ourselves: search engine guidelines, geo based redirects and a dynamic link handling for internal documents.
This Bundle helps you mastering this challenges and gives you the freedom to elaborate complex country based localization strategies.
Expand All @@ -25,7 +22,7 @@ This Bundle helps you mastering this challenges and gives you the freedom to ela

```json
"require" : {
"dachcom-digital/i18n" : "~2.4.0"
"dachcom-digital/i18n" : "~3.0.0"
}
```

Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "dachcom-digital/i18n",
"type": "pimcore-bundle",
"license": "GPL-3.0-or-later",
"description": "Pimcore 5.x I18n Manager.",
"description": "Pimcore I18n Manager.",
"keywords": ["pimcore", "i18n", "localization", "internationalization"],
"homepage": "https://github.com/dachcom-digital/pimcore-i18n",
"authors": [
Expand All @@ -28,10 +28,10 @@
}
},
"require": {
"pimcore/core-version": "^5.4.0"
"pimcore/pimcore": "^6.0.0"
},
"require-dev": {
"codeception/codeception": "~2.3.0",
"codeception/codeception": "~2.4.0",
"phpstan/phpstan": "^0.11.1",
"phpstan/phpstan-symfony": "^0.11.0",
"symplify/easy-coding-standard": "^5.4"
Expand Down
6 changes: 3 additions & 3 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ includes:
- ../../vendor/phpstan/phpstan-symfony/extension.neon
parameters:
reportUnmatchedIgnoredErrors: false
autoload_files:
- %currentWorkingDirectory%/vendor/pimcore/pimcore/stubs/compatibility-v4.php
symfony:
container_xml_path: var/cache/dev/appDevDebugProjectContainer.xml
container_xml_path: var/cache/dev/appAppKernelDevDebugContainer.xml
ignoreErrors:
# There is no global constants definition file we could include, ignore it:
- '#Constant PIMCORE_[A-Z\\_]+ not found\.#'
# Symfony DI (remove this line after symfony 4 support only):
- '#Method Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface::dispatch\(\) invoked with 2 parameters, 1 required\.#'
# Symfony DI (remove this line with symfony 4.2):
- '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::children\(\)\.#'
Original file line number Diff line number Diff line change
Expand Up @@ -259,15 +259,17 @@ private function setRuntime(Request $request, Document $document, $newDocumentLo
DataObject\AbstractObject::setGetInheritedValues(true);
DataObject\Localizedfield::setGetFallbackValues(true);

$request->setLocale($newDocumentLocale);
$request->setDefaultLocale($newDocumentLocale);
$request->attributes->set('_locale', $newDocumentLocale);
$document->setProperty('language', 'string', $newDocumentLocale);
$saveLocale = is_null($newDocumentLocale) ? 'en' : $newDocumentLocale;

$request->setLocale($saveLocale);
$request->setDefaultLocale($saveLocale);
$request->attributes->set('_locale', $saveLocale);
$document->setProperty('language', 'string', $saveLocale);

//fix i18n language / country context.
Cache\Runtime::set('i18n.locale', $newDocumentLocale);
Cache\Runtime::set('i18n.locale', $saveLocale);

$docLang = explode('_', $newDocumentLocale);
$docLang = explode('_', $saveLocale);
Cache\Runtime::set('i18n.languageIso', strtolower($docLang[0]));

$countryIso = Definitions::INTERNATIONAL_COUNTRY_NAMESPACE;
Expand Down
2 changes: 1 addition & 1 deletion tests/_etc/bundle_configuration
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export DACHCOM_BUNDLE_INSTALLER_CLASS='I18nBundle\Tool\Install'
declare -A DACHCOM_INSTALL_CONFIG_FILES=(
# system files
["$DACHCOM_BUNDLE_HOME/_etc/config/bundle/extensions.template.php"]="var/config/extensions.php"
["$DACHCOM_BUNDLE_HOME/_etc/config/bundle/system.template.php"]="var/config/system.php"
["$DACHCOM_BUNDLE_HOME/_etc/config/bundle/system.template.yml"]="var/config/system.yml"
["$DACHCOM_BUNDLE_HOME/_etc/config/bundle/appKernel"]="app/AppKernel.php"
# template files
["$DACHCOM_BUNDLE_HOME/_etc/config/bundle/template/controller/DefaultController"]="src/AppBundle/Controller/DefaultController.php"
Expand Down
172 changes: 0 additions & 172 deletions tests/_etc/config/bundle/system.template.php

This file was deleted.

Loading

0 comments on commit 6681cb6

Please sign in to comment.