Skip to content

[WIP][TASK] Fix failing tests in v2 #466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 37 commits into
base: develop-2.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
288155a
[TASK] Require at least TYPO3 ^9.5 and ^10.4
mabolek Nov 20, 2020
383d6a8
[FEATURE] CI with Github Actions
mabolek Nov 20, 2020
16c2329
[TASK] Include typoscript linter and raise codesniffer version
mabolek Dec 3, 2020
94961a9
[TASK] Added composer scripts
mabolek Dec 3, 2020
cc3d6bb
[TASK] Renamed .ts to .typoscript
mabolek Dec 3, 2020
130c1da
[TASK] Added .editorconfig
mabolek Dec 3, 2020
0275916
[CLEANUP] CS compliance for TypoScript
mabolek Dec 3, 2020
4a67d39
[CLEANUP] CS compliance for PHP
mabolek Dec 3, 2020
14fab17
[CLEANUP] CS fix TypoScript indentation
mabolek Dec 3, 2020
73454c5
Revert "[CLEANUP] CS fix TypoScript indentation"
mabolek Dec 3, 2020
097ea38
[TASK] Add TS lint configuration
mabolek Dec 3, 2020
751edbc
[TASK] Added PHP CS config from TYPO3 Core
mabolek Dec 3, 2020
7bb5ba7
[CLEANUP] TypoScript CS fixes
mabolek Dec 3, 2020
6133f79
[TASK] Migrate to php-cs-fixer for sniff and fix
mabolek Dec 18, 2020
a99c4bd
[TASK] Set PHP 7.4 for code sniffer job
mabolek Jan 12, 2021
914d3fc
[TASK] Set PHP 7.4 for TS linter job
mabolek Jan 12, 2021
003d6ed
[TASK] Set TS linter indent level to 2
mabolek Jan 12, 2021
b8c8fbf
[TASK] Move php-cs-fixer config to root directory
mabolek Jan 12, 2021
fea48eb
[TASK] Delete .travis.yml
mabolek Jan 12, 2021
a7a9aed
[TASK] Set checkstyle format on php sniff
mabolek Jan 12, 2021
cd427c4
[TASK] Enabled diff for PHP sniffer
mabolek Jan 12, 2021
e1e49ab
[TASK] Fixed root directory
mabolek Jan 12, 2021
311b784
[TASK] Fixed root directory
mabolek Jan 12, 2021
cc9e071
[CLEANUP] CS fixes
mabolek Jan 12, 2021
0ea2653
[TASK] Exclude PHP <7.4 for TYPO3 v10.4
mabolek Jan 12, 2021
16a7384
[TASK] Include PHP <7.4 for TYPO3 v10.4
mabolek Jan 12, 2021
9508abe
[TASK] Disable composer v2
mabolek Jan 12, 2021
e609f1d
[TASK] Include testing framework 5 and enable composer v2
mabolek Jan 12, 2021
46beb35
[TASK] Require nimut/testing-framework ^5.0
mabolek Jan 12, 2021
52a2583
[TASK] Fixed test root path
mabolek Jan 12, 2021
c3570ef
[TASK] Fixed test root path
mabolek Jan 12, 2021
d6e6cdb
[TASK] Removed TYPO3 root path
mabolek Jan 12, 2021
d0ada23
[TASK] Updated unit tests
mabolek Jan 12, 2021
149e62f
[TASK] Ignore /var
mabolek Jan 12, 2021
86ee420
[TASK] Remove unused version code
mabolek Jan 12, 2021
09ec5f4
[TASK] Refactored ExtensionManagerConfigurationService into a utility
mabolek Jan 12, 2021
faabfc0
[TASK] Trying to get all tests working
mabolek Jan 13, 2021
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
52 changes: 52 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# EditorConfig is awesome: http://EditorConfig.org

# top-most EditorConfig file
root = true

# Unix-style newlines with a newline ending every file
[*]
charset = utf-8
end_of_line = lf
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

# TS/JS-Files
[*.{ts,js}]
indent_size = 2

# JSON-Files
[*.json]
indent_style = tab

# ReST-Files
[*.rst]
indent_size = 3
max_line_length = 80

# YAML-Files
[*.{yaml,yml}]
indent_size = 2

# package.json
# .travis.yml
[{package.json,.travis.yml}]
indent_size = 2

# TypoScript
[*.{typoscript,tsconfig}]
indent_size = 2

# XLF-Files
[*.xlf]
indent_style = tab

# SQL-Files
[*.sql]
indent_style = tab
indent_size = 2

# .htaccess
[{_.htaccess,.htaccess}]
indent_style = tab
178 changes: 178 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
on:
push:
branches:
- '*'
- '!master'

name: CI

jobs:
php-lint:
name: PHP linter

runs-on: ubuntu-latest

strategy:
matrix:
php-version:
- 7.2
- 7.3
- 7.4

steps:
- name: Configure PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}

- name: Checkout
uses: actions/checkout@v1

- name: Run PHP lint
run: |
echo "${{ matrix.exclude-pattern }}"
find *.php Classes/ Configuration/ Tests/ -name '*.php' ${{ matrix.exclude-pattern }}
find *.php Classes/ Configuration/ Tests/ -name '*.php' ${{ matrix.exclude-pattern }} -print0 | xargs -0 -n 1 -P 4 php -l

typoscript-lint:
name: TypoScript linter

runs-on: ubuntu-latest

steps:
- name: Configure PHP 7.4
uses: shivammathur/setup-php@v2
with:
php-version: 7.4

- name: Checkout
uses: actions/checkout@v1

- name: "Cache dependencies installed with composer"
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-composer-
- name: Install Composer dependencies
run: composer install --no-progress

- name: Run TypoScript lint
run: composer ci:ts:lint

php-code-sniffer:
name: PHP Code Sniffer

runs-on: ubuntu-latest

steps:
- name: Configure PHP 7.4
uses: shivammathur/setup-php@v2
with:
php-version: 7.4

- name: Checkout
uses: actions/checkout@v1

- name: "Cache dependencies installed with composer"
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-composer-
- name: Install Composer dependencies
run: composer install --no-progress

- name: Run PHP Code Sniffer
run: composer ci:php:sniff

unit-tests:
name: Unit tests

runs-on: ubuntu-latest

strategy:
matrix:
composer-version:
- v1
- v2
typo3-version:
- "^9.5"
- "^10.4"
composer-dependencies:
- highest
- lowest
php-version:
- 7.2
- 7.3
- 7.4
include:
- typo3-version: "^9.5"
database-image: mariadb:latest
- typo3-version: "^10.4"
database-image: mariadb:latest

services:
mysql:
image: ${{ matrix.database-image }}
env:
MYSQL_ALLOW_EMPTY_PASSWORD: false
MYSQL_DATABASE: typo3
MYSQL_ROOT_PASSWORD: password
MYSQL_USER: user
ports:
- 3306

steps:
- name: Configure PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: fileinfo, filter, gd, hash, intl, json, mbstring, mysqli, openssl, pcre, session, SPL, xml, zip, zlib
coverage: none
tools: composer:${{ matrix.composer-version }}

- name: Checkout
uses: actions/checkout@v1

- name: "Cache dependencies installed with composer"
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-composer-

- name: Install TYPO3 Core
env:
TYPO3: ${{ matrix.typo3-version }}
run: |
composer --version
composer require typo3/minimal:"${{ matrix.typo3-version }}"
composer show

- name: Install lowest dependencies with composer
if: matrix.composer-dependencies == 'lowest'
run: |
composer update --no-ansi --no-interaction --no-progress --no-suggest --prefer-lowest
composer show

- name: Install highest dependencies with composer
if: matrix.composer-dependencies == 'highest'
run: |
composer update --no-ansi --no-interaction --no-progress --no-suggest
composer show

- name: Run unit tests
run: composer ci:tests:unit

- name: Run functional tests
env:
typo3DatabaseHost: 127.0.0.1
typo3DatabasePort: ${{ job.services.mysql.ports['3306'] }}
typo3DatabaseName: typo3
typo3DatabaseUsername: root
typo3DatabasePassword: password
run: composer ci:tests:functional
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,5 @@ package-lock.json

# PHP CS fix caches
.php_cs.cache

/var
67 changes: 38 additions & 29 deletions Build/.php_cs → .php_cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* And then simply run
*
* $ php-cs-fixer fix --config ../Build/.php_cs
* $ ./bin/php-cs-fixer fix --config ./Build/.php_cs
*
* inside the TYPO3 directory. Warning: This may take up to 10 minutes.
*
Expand All @@ -31,10 +31,7 @@
if (PHP_SAPI !== 'cli') {
die('This script supports command line usage only. Please check your command.');
}
// Define in which folders to search and which folders to exclude
// Exclude some directories that are excluded by Git anyways to speed up the sniffing
$finder = PhpCsFixer\Finder::create()
->in(__DIR__ . '/../');

// Return a Code Sniffing configuration using
// all sniffers needed for PSR-2
// and additionally:
Expand All @@ -47,41 +44,53 @@ $finder = PhpCsFixer\Finder::create()
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'@DoctrineAnnotation' => true,
'no_leading_import_slash' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_unused_imports' => true,
'concat_space' => ['spacing' => 'one'],
'no_whitespace_in_blank_line' => true,
'ordered_imports' => true,
'single_quote' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => true,
'phpdoc_no_package' => true,
'phpdoc_scalar' => true,
'no_blank_lines_after_phpdoc' => true,
'@PSR2' => true,
'array_syntax' => ['syntax' => 'short'],
'whitespace_after_comma_in_array' => true,
'blank_line_after_opening_tag' => true,
'braces' => ['allow_single_line_closure' => true],
'cast_spaces' => ['space' => 'none'],
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'],
'dir_constant' => true,
'function_typehint_space' => true,
'hash_to_slash_comment' => true,
'no_alias_functions' => true,
'lowercase_cast' => true,
'no_leading_namespace_whitespace' => true,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'modernize_types_casting' => true,
'native_function_casing' => true,
'new_with_braces' => true,
'no_alias_functions' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_null_property_initialization' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_control_parentheses' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_whitespace_in_blank_line' => true,
'ordered_imports' => true,
'php_unit_construct' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame'],
'php_unit_mock_short_will_return' => true,
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'phpdoc_no_access' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_no_package' => true,
'phpdoc_scalar' => true,
'phpdoc_trim' => true,
'no_superfluous_elseif' => true,
'no_useless_else' => true,
'phpdoc_types' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'return_type_declaration' => ['space_before' => 'none'],
'cast_spaces' => ['space' => 'none'],
'declare_equal_normalize' => ['space' => 'single'],
'dir_constant' => true,
'phpdoc_no_access' => true
'single_quote' => true,
'single_trait_insert_per_statement' => true,
'whitespace_after_comma_in_array' => true,
])
->setFinder($finder);
->setFinder(PhpCsFixer\Finder::create()->in(__DIR__));
41 changes: 0 additions & 41 deletions .travis.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
declare(strict_types = 1);

declare(strict_types=1);
namespace TYPO3\CMS\FrontendEditing\Backend\Controller\ContentElement;

/*
Expand Down
Loading