Skip to content

Commit 2856bd2

Browse files
authored
Merge pull request #24 from Dam1an1208/main
!!! FEATURE: Compatibility for Neos 9
2 parents 9356ac2 + 6cd4378 commit 2856bd2

24 files changed

+3967
-4552
lines changed

.github/workflows/tests.yml

Lines changed: 74 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,33 @@ on:
66
pull_request:
77
branches: [ main ]
88

9+
env:
10+
PACKAGE_FOLDER: Shel.Neos.Terminal
11+
912
jobs:
1013
build:
1114
runs-on: ubuntu-latest
1215

1316
strategy:
1417
matrix:
18+
php-versions:
19+
- '8.2'
1520
neosVersion:
16-
- '8.3'
21+
- '9.0'
22+
23+
services:
24+
mariadb:
25+
# see https://mariadb.com/kb/en/mariadb-server-release-dates/
26+
# this should be a current release, e.g. the LTS version
27+
image: mariadb:10.8
28+
env:
29+
MYSQL_USER: neos
30+
MYSQL_PASSWORD: neos
31+
MYSQL_DATABASE: neos_functional_testing
32+
MYSQL_ROOT_PASSWORD: neos
33+
ports:
34+
- "3306:3306"
35+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
1736

1837
name: 'Terminal with Neos ${{ matrix.neosVersion }} test'
1938

@@ -23,40 +42,57 @@ jobs:
2342
FLOW_FOLDER: ../neos-base-distribution
2443

2544
steps:
26-
- uses: actions/checkout@v3
27-
28-
- name: Setup PHP
29-
uses: shivammathur/setup-php@v2
30-
with:
31-
php-version: 8.1
32-
tools: composer:v2
33-
34-
- name: Get composer cache directory
35-
id: composer-cache
36-
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
37-
38-
- name: Cache dependencies
39-
uses: actions/cache@v3
40-
with:
41-
path: ${{ steps.composer-cache.outputs.dir }}
42-
key: ${{ runner.os }}-composer-${{ matrix.neosVersion }}-${{ hashFiles('**/composer.json') }}
43-
restore-keys: ${{ runner.os }}-composer-${{ matrix.neosVersion }}-
44-
45-
- name: Prepare Flow distribution
46-
run: |
47-
git clone https://github.com/neos/neos-base-distribution.git -b ${NEOS_TARGET_VERSION} ${FLOW_FOLDER}
48-
cd ${FLOW_FOLDER}
49-
composer require --no-update --no-interaction shel/neos-terminal
50-
51-
- name: Install distribution
52-
run: |
53-
cd ${FLOW_FOLDER}
54-
composer config --no-plugins allow-plugins.neos/composer-plugin true
55-
composer install --no-interaction --no-progress
56-
rm -rf Packages/Plugins/Shel.Neos.Terminal
57-
cp -r ../Shel.Neos.Terminal Packages/Plugins/Shel.Neos.Terminal
58-
59-
- name: Run Functional tests
60-
run: |
61-
cd ${FLOW_FOLDER}
62-
bin/phpunit --colors -c Build/BuildEssentials/PhpUnit/FunctionalTests.xml Packages/Plugins/Shel.Neos.Terminal/Tests/Functional/*
45+
- uses: actions/checkout@v3
46+
47+
- name: Set package branch name
48+
run: echo "PACKAGE_TARGET_VERSION=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_ENV
49+
working-directory: .
50+
51+
- name: Setup PHP
52+
uses: shivammathur/setup-php@v2
53+
with:
54+
php-version: ${{ matrix.php-versions }}
55+
extensions: mbstring, xml, json, zlib, iconv, intl, pdo_sqlite, mysql
56+
tools: composer:v2
57+
58+
- name: Cache dependencies
59+
uses: actions/cache@v3
60+
with:
61+
path: ~/.composer/cache
62+
key: dependencies-composer-${{ hashFiles('composer.json') }}
63+
64+
- name: Prepare Flow distribution
65+
run: |
66+
git clone https://github.com/neos/neos-base-distribution.git -b ${NEOS_TARGET_VERSION} ${FLOW_FOLDER}
67+
cd ${FLOW_FOLDER}
68+
69+
git -C ../${{ env.PACKAGE_FOLDER }} checkout -b build
70+
composer config repositories.package '{ "type": "path", "url": "../${{ env.PACKAGE_FOLDER }}", "options": { "symlink": false } }'
71+
composer require --no-update --no-interaction shel/neos-terminal:"dev-build as dev-${PACKAGE_TARGET_VERSION}"
72+
composer require --no-update --no-interaction neos/contentgraph-doctrinedbaladapter:"~9.0.0"
73+
74+
- name: Composer Install
75+
run: |
76+
cd ${FLOW_FOLDER}
77+
composer update --no-interaction --no-progress
78+
79+
- name: Setup Flow configuration
80+
run: |
81+
cd ${FLOW_FOLDER}
82+
rm -f Configuration/Testing/Settings.yaml
83+
cat <<EOF >> Configuration/Testing/Settings.yaml
84+
Neos:
85+
Flow:
86+
persistence:
87+
backendOptions:
88+
host: '127.0.0.1'
89+
driver: pdo_mysql
90+
user: 'neos'
91+
password: 'neos'
92+
dbname: 'neos_functional_testing'
93+
EOF
94+
95+
- name: Run Functional tests
96+
run: |
97+
cd ${FLOW_FOLDER}
98+
bin/phpunit --colors -c Build/BuildEssentials/PhpUnit/FunctionalTests.xml Packages/Plugins/Shel.Neos.Terminal/Tests/Functional/*

.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Lines changed: 0 additions & 541 deletions
This file was deleted.

.yarn/releases/yarn-3.3.1.cjs

Lines changed: 0 additions & 823 deletions
This file was deleted.

.yarn/releases/yarn-4.9.2.cjs

Lines changed: 942 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
compressionLevel: mixed
2+
13
enableGlobalCache: true
4+
25
nodeLinker: node-modules
3-
yarnPath: .yarn/releases/yarn-3.3.1.cjs
6+
47
pnpMode: loose
58

6-
plugins:
7-
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
8-
spec: "@yarnpkg/plugin-interactive-tools"
9+
yarnPath: .yarn/releases/yarn-4.9.2.cjs

Classes/Command/EvaluateEelExpressionCommand.php

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,8 @@
2424

2525
class EvaluateEelExpressionCommand implements TerminalCommandInterface
2626
{
27-
/**
28-
* @Flow\Inject
29-
* @var EelEvaluationService
30-
*/
31-
protected $eelEvaluationService;
27+
#[Flow\Inject]
28+
protected EelEvaluationService $eelEvaluationService;
3229

3330
public static function getCommandName(): string
3431
{

Classes/Command/FlushCacheCommand.php

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515

1616
use Neos\Flow\Annotations as Flow;
1717
use Neos\Flow\Cache\CacheManager;
18+
use Neos\Flow\I18n\Exception\IndexOutOfBoundsException;
19+
use Neos\Flow\I18n\Exception\InvalidFormatPlaceholderException;
1820
use Neos\Flow\I18n\Translator;
1921
use Shel\Neos\Terminal\Domain\CommandContext;
2022
use Shel\Neos\Terminal\Domain\CommandInvocationResult;
@@ -26,17 +28,11 @@
2628
class FlushCacheCommand implements TerminalCommandInterface
2729
{
2830

29-
/**
30-
* @Flow\Inject
31-
* @var CacheManager
32-
*/
33-
protected $cacheManager;
31+
#[Flow\Inject]
32+
protected CacheManager $cacheManager;
3433

35-
/**
36-
* @Flow\Inject
37-
* @var Translator
38-
*/
39-
protected $translator;
34+
#[Flow\Inject]
35+
protected Translator $translator;
4036

4137
public static function getCommandName(): string
4238
{
@@ -77,16 +73,19 @@ public function invokeCommand(string $argument, CommandContext $commandContext):
7773
if ($cacheIdentifier) {
7874
if ($this->cacheManager->hasCache($cacheIdentifier)) {
7975
$this->cacheManager->getCache($cacheIdentifier)->flush();
80-
$result = $this->translator->translateById('command.flushCache.flushedOne',
81-
['cacheIdentifier' => $cacheIdentifier], null, null, 'Main', 'Shel.Neos.Terminal');
76+
$result = $this->translateById(
77+
'command.flushCache.flushedOne',
78+
['cacheIdentifier' => $cacheIdentifier]
79+
);
8280
} else {
8381
$success = false;
84-
$result = $this->translator->translateById('command.flushCache.cacheDoesNotExist',
85-
['cacheIdentifier' => $cacheIdentifier], null, null, 'Main', 'Shel.Neos.Terminal');
82+
$result = $this->translateById(
83+
'command.flushCache.cacheDoesNotExist',
84+
['cacheIdentifier' => $cacheIdentifier]
85+
);
8686
}
8787
} else {
88-
$result = $this->translator->translateById('command.flushCache.flushedAll', [], null, null, 'Main',
89-
'Shel.Neos.Terminal');
88+
$result = $this->translateById('command.flushCache.flushedAll');
9089
$this->cacheManager->flushCaches();
9190
}
9291

@@ -97,7 +96,23 @@ public function invokeCommand(string $argument, CommandContext $commandContext):
9796
echo json_encode([
9897
'success' => $success,
9998
'result' => $result,
100-
]);
99+
], JSON_THROW_ON_ERROR);
101100
exit;
102101
}
102+
103+
protected function translateById(string $identifier, array $arguments = []): ?string
104+
{
105+
try {
106+
return $this->translator->translateById(
107+
$identifier,
108+
$arguments, null,
109+
null,
110+
'Main',
111+
'Shel.Neos.Terminal'
112+
);
113+
} catch (\Exception) {
114+
// Noop
115+
}
116+
return $identifier;
117+
}
103118
}

0 commit comments

Comments
 (0)