Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s functional
if: matrix.TYPO3 == '14'

- name: Acceptance Tests
- name: Acceptance Tests Classic
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s acceptance -- --fail-fast
- name: Archive acceptance tests results
uses: actions/upload-artifact@v6
Expand All @@ -54,6 +54,14 @@ jobs:
name: acceptance-test-reports-${{ matrix.php }}-${{ matrix.TYPO3 }}
path: .Build/Web/typo3temp/var/tests/_output

- name: Acceptance Tests Composer
run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -t ${{ matrix.TYPO3 }} -s acceptanceComposer -- --fail-fast
- name: Archive acceptance tests results
uses: actions/upload-artifact@v6
if: always()
with:
name: acceptance-test-composer-reports-${{ matrix.php }}-${{ matrix.TYPO3 }}
path: .Build/Web/typo3temp/var/tests_composer/_output
- name: Archive composer.lock
uses: actions/upload-artifact@v6
if: always()
Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ config
.cache
composer.json.orig
composer.json.testing
bck-runTests.sh
Build/acceptance_tests/composer.json
Build/acceptance_tests/composer.lock
Build/acceptance_tests/vendor
Build/acceptance_tests/b13-container
Build/acceptance_tests/public
243 changes: 135 additions & 108 deletions Build/Scripts/runTests.sh

Large diffs are not rendered by default.

91 changes: 91 additions & 0 deletions Build/Scripts/setupAcceptanceComposer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/bin/sh

#
# Set up a composer-installed TYPO3 test instance for acceptance testing.
# Called by runTests.sh -s acceptanceComposer.
#
# Creates symlinks so that Build/composer/composer.dist.json can reference
# local paths with short names instead of deeply-nested relative URLs.
# Mirrors the approach used in the TYPO3 core's setupAcceptanceComposer.sh.
#

set -e

cd "$(dirname $(realpath $0))/../../"

PROJECT_PATH=${1:-.Build/Web/typo3temp/var/tests/acceptance-composer}
export TYPO3_DB_DRIVER=${TYPO3_DB_DRIVER:-sqlite}
TYPO3_VERSION="${TYPO3:-14}"

# Compute the relative path from PROJECT_PATH back to the project root.
# e.g. ".Build/Web/typo3temp/var/tests/acceptance-composer" -> "../../../../../../"
RELATIVE_ROOT=$(echo "${PROJECT_PATH}" | sed -e 's/[^\/][^\/]*/../g' -e 's/\/$//')

mkdir -p "${PROJECT_PATH}"

# b13-container -> project root (provides the b13/container path repository)
# packages -> Build/tests/packages (provides typo3tests/dataset-import)
ln -snf "${RELATIVE_ROOT}" "${PROJECT_PATH}/b13-container"
ln -snf "${RELATIVE_ROOT}/Build/acceptance_tests/packages" "${PROJECT_PATH}/packages"
rm -f "${PROJECT_PATH}/composer.json"
ln -snf "${RELATIVE_ROOT}/Build/acceptance_tests/composer.${TYPO3_VERSION}.json" "${PROJECT_PATH}/composer.json"
rm -rf "${PROJECT_PATH}/config"
mkdir -p "${PROJECT_PATH}/config/system/"
ln -snf "${RELATIVE_ROOT}/../Build/sites" "${PROJECT_PATH}/config/sites"

cd "${PROJECT_PATH}"

rm -rf composer.lock public/ var/ vendor/

cat > "config/system/additional.php" <<\EOF
<?php
$GLOBALS['TYPO3_CONF_VARS']['BE']['debug'] = true;
// "Temporary Password - 123"
$GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'] = '$argon2i$v=19$m=65536,t=16,p=1$c3hCMGVXOHhRd0M3MzhSVw$WPQHpElapKMxsxfSkkXw5YQxGKN+rGmjM8vQv3g79YY';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors'] = true;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'] = '*';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['exceptionalErrors'] = E_ALL;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandlerErrors'] = E_ALL;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = '.*';
$GLOBALS['TYPO3_CONF_VARS']['GFX']['processor'] = 'GraphicsMagick';
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport'] = 'mbox';
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_mbox_file'] = \TYPO3\CMS\Core\Core\Environment::getVarPath() . '/log/mail.mbox';
EOF


composer install --no-progress --no-interaction --dev

TYPO3_SERVER_TYPE=apache \
TYPO3_PROJECT_NAME="Container Test" \
vendor/bin/typo3 setup --force --no-interaction

echo "empty db"
vendor/bin/typo3 dataset:empty-db

echo "import fixtures"
# Import acceptance test fixtures. vendor/b13/container symlinks back to the
# project root via the b13-container path repository.
FIXTURES="vendor/b13/container/Tests/Acceptance/Fixtures"
vendor/bin/typo3 dataset:import "${FIXTURES}/be_users.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/be_groups.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/sys_workspace.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pages.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/contentDefenderMaxitems.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/contentTCASelectCtype.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/emptyPage.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithContainer.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithContainer-2.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithContainer-3.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithContainer-4.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithContainer-5.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithContainer-6.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithDifferentContainers.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithLocalization.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithLocalizationFreeModeWithContainer.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithTranslatedContainer.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithTranslatedContainer-2.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithWorkspace.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithWorkspace-movedContainer.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithWorkspace-changedContainer.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithContainerAndContentElementOutside.csv"
echo "finished"
8 changes: 8 additions & 0 deletions Build/acceptance_tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### composer acceptance tests

cd Build/acceptance_tests
./setup_local.sh
./start_env.sh
php -d memory_limit=2G .Build/bin/codecept run Backend --env=local,localheadless,composer -c Tests/codeception.yml --fail-fast
php -d memory_limit=2G .Build/bin/codecept run Backend --env=local,localheadless,composer -c Tests/codeception.yml Tests/Acceptance/Backend/PageTsConfigModuleCest.php
./stop_env.sh
27 changes: 27 additions & 0 deletions Build/acceptance_tests/composer.13.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"repositories": [
{"type": "path", "url": "b13-container"},
{"type": "path", "url": "packages/*"}
],
"require": {
"typo3/cms-backend": "^13.4",
"typo3/cms-frontend": "^13.4",
"typo3/cms-install": "^13.4",
"typo3/cms-fluid-styled-content": "^13.4",
"typo3/cms-info": "^13.4",
"typo3/cms-workspaces": "^13.4",
"b13/container": "@dev",
"ichhabrecht/content-defender": "*",
"typo3tests/dataset-import": "@dev",
"typo3/testing-framework": "^9.1",
"b13/container-example": "dev-master"
},
"config": {
"allow-plugins": {
"typo3/class-alias-loader": true,
"typo3/cms-composer-installers": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
26 changes: 26 additions & 0 deletions Build/acceptance_tests/composer.14.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"repositories": [
{"type": "path", "url": "b13-container"},
{"type": "path", "url": "packages/*"}
],
"require": {
"typo3/cms-backend": "^14.3",
"typo3/cms-frontend": "^14.3",
"typo3/cms-install": "^14.3",
"typo3/cms-fluid-styled-content": "^14.3",
"typo3/cms-info": "^14.3",
"typo3/cms-workspaces": "^14.3",
"b13/container": "@dev",
"typo3tests/dataset-import": "@dev",
"typo3/testing-framework": "^9.1",
"b13/container-example": "dev-master"
},
"config": {
"allow-plugins": {
"typo3/class-alias-loader": true,
"typo3/cms-composer-installers": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

namespace TYPO3Tests\DatasetImport\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use TYPO3\TestingFramework\Core\Functional\Framework\DataHandling\DataSet;

#[AsCommand('dataset:import', 'Import Dataset')]
class DatasetImportCommand extends Command
{
protected function configure(): void
{
$this->addArgument('path', InputArgument::REQUIRED, 'Path to CSV dataset to import');
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
DataSet::import($input->getArgument('path'));
return Command::SUCCESS;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);

namespace TYPO3Tests\DatasetImport\Command;

use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use TYPO3\CMS\Core\Database\ConnectionPool;

#[AsCommand('dataset:empty-db')]
class EmptyDbCommand extends Command
{
public function __construct(private readonly ConnectionPool $connectionPool, ?string $name = null, ?callable $code = null)
{
parent::__construct($name, $code);
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$connection = $this->connectionPool->getConnectionForTable('be_users');
$connection->truncate('be_users');
return Command::SUCCESS;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
services:
_defaults:
autowire: true
autoconfigure: true
public: false

TYPO3Tests\DatasetImport\:
resource: '../Classes/*'
20 changes: 20 additions & 0 deletions Build/acceptance_tests/packages/dataset_import/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "typo3tests/dataset-import",
"type": "typo3-cms-extension",
"description": "Support extension providing dataset:import command",
"license": "GPL-2.0-or-later",
"require": {
"typo3/cms-core": "^13.4 || ^14.3",
"typo3/testing-framework": "^9.1"
},
"extra": {
"typo3/cms": {
"extension-key": "dataset_import"
}
},
"autoload": {
"psr-4": {
"TYPO3Tests\\DatasetImport\\": "Classes/"
}
}
}
3 changes: 3 additions & 0 deletions Build/acceptance_tests/restart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

./stop_env.sh && ./setup.sh && ./stop_env.sh
77 changes: 77 additions & 0 deletions Build/acceptance_tests/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/bin/sh

set -e

export TYPO3_DB_DBNAME="bar"
export TYPO3_DB_USERNAME="dev"
export TYPO3_DB_PASSWORD="dev"
export TYPO3_DB_HOST="127.0.0.1"
export TYPO3_DB_DRIVER=mysqli
export TYPO3_DB_PORT=3306
export TYPO3_SERVER_TYPE=apache
export TYPO3_PROJECT_NAME="Container Test"
TYPO3_VERSION="${TYPO3:-14}"
RELATIVE_ROOT="../../"
PROJECT_PATH="."

echo "drop database if exists ${TYPO3_DB_DBNAME};" |mysql
echo "create database ${TYPO3_DB_DBNAME} DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;" |mysql


ln -snf "${RELATIVE_ROOT}" "${PROJECT_PATH}/b13-container"

rm -rf composer.lock config/ public/ var/ vendor/

mkdir -p "config/system/"
ln -snf "${RELATIVE_ROOT}sites" "${PROJECT_PATH}/config/sites"
cat > "config/system/additional.php" <<\EOF
<?php
$GLOBALS['TYPO3_CONF_VARS']['BE']['debug'] = true;
// "Temporary Password - 123"
$GLOBALS['TYPO3_CONF_VARS']['BE']['installToolPassword'] = '$argon2i$v=19$m=65536,t=16,p=1$c3hCMGVXOHhRd0M3MzhSVw$WPQHpElapKMxsxfSkkXw5YQxGKN+rGmjM8vQv3g79YY';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors'] = true;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['devIPmask'] = '*';
$GLOBALS['TYPO3_CONF_VARS']['SYS']['exceptionalErrors'] = E_ALL;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['errorHandlerErrors'] = E_ALL;
$GLOBALS['TYPO3_CONF_VARS']['SYS']['trustedHostsPattern'] = '.*';
$GLOBALS['TYPO3_CONF_VARS']['GFX']['processor'] = 'GraphicsMagick';
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport'] = 'mbox';
$GLOBALS['TYPO3_CONF_VARS']['MAIL']['transport_mbox_file'] = \TYPO3\CMS\Core\Core\Environment::getVarPath() . '/log/mail.mbox';
EOF

cp "composer.${TYPO3_VERSION}.json" composer.json

# `composer require` implicitly performs an initial install since there is no composer.lock.
composer install --no-progress --no-interaction --dev
vendor/bin/typo3 setup --force --no-interaction

echo "empty db"
vendor/bin/typo3 dataset:empty-db

echo "import fixtures"
# Import acceptance test fixtures. vendor/b13/container symlinks back to the
# project root via the b13-container path repository.
FIXTURES="vendor/b13/container/Tests/Acceptance/Fixtures"
vendor/bin/typo3 dataset:import "${FIXTURES}/be_users.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/be_groups.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/sys_workspace.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pages.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/contentDefenderMaxitems.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/contentTCASelectCtype.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/emptyPage.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithContainer.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithContainer-2.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithContainer-3.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithContainer-4.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithContainer-5.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithContainer-6.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithDifferentContainers.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithLocalization.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithLocalizationFreeModeWithContainer.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithTranslatedContainer.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithTranslatedContainer-2.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithWorkspace.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithWorkspace-movedContainer.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithWorkspace-changedContainer.csv"
vendor/bin/typo3 dataset:import "${FIXTURES}/pageWithContainerAndContentElementOutside.csv"
echo "finished"
5 changes: 5 additions & 0 deletions Build/acceptance_tests/start_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

cp ../router.php public
php -S 0.0.0.0:8080 -t public/ public/router.php & echo $! > var/php_pid
chromedriver --url-base=/wd/hub --port=9515 & echo $! > var/chromedriver_pid
4 changes: 4 additions & 0 deletions Build/acceptance_tests/stop_env.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

kill `cat var/php_pid`
kill `cat var/chromedriver_pid`
4 changes: 4 additions & 0 deletions Tests/Acceptance/Backend.suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ env:
extensions:
enabled:
- B13\Container\Tests\Acceptance\Support\Extension\BackendContainerEnvironment
composer:
extensions:
enabled:
- B13\Container\Tests\Acceptance\Support\Extension\BackendContainerEnvironmentComposer

groups:
AcceptanceTests-Job-*: AcceptanceTests-Job-*
Loading