diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 55da5f89..f912807c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,15 +15,10 @@ jobs: php: [ '8.2', '8.3', '8.4' ] steps: - - name: Extract branch name - shell: bash - run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT - id: extract_branch - - - name: Checkout ${{ steps.extract_branch.outputs.branch }} + - name: Checkout ${{ github.event_name == 'workflow_dispatch' && github.head_ref || '' }} uses: actions/checkout@v4 with: - ref: ${{ steps.extract_branch.outputs.branch }} + ref: ${{ github.event_name == 'workflow_dispatch' && github.head_ref || '' }} - name: Composer install run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s composerUpdate diff --git a/Build/phpstan/phpstan-baseline.neon b/Build/phpstan/phpstan-baseline.neon index 364905f7..461c373c 100644 --- a/Build/phpstan/phpstan-baseline.neon +++ b/Build/phpstan/phpstan-baseline.neon @@ -1,2 +1,37 @@ parameters: ignoreErrors: + - + message: '#^Offset 0 on non\-empty\-list\ on left side of \?\? always exists and is not nullable\.$#' + identifier: nullCoalesce.offset + count: 1 + path: ../../Classes/Composer/ComposerPackageManager.php + + - + message: '#^Trait TYPO3\\TestingFramework\\Core\\AccessibleProxyTrait is used zero times and is not analysed\.$#' + identifier: trait.unused + count: 1 + path: ../../Classes/Core/AccessibleProxyTrait.php + + - + message: '#^Call to function is_array\(\) with non\-empty\-array will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType + count: 1 + path: ../../Classes/Core/Functional/Framework/Constraint/RequestSection/DoesNotHaveRecordConstraint.php + + - + message: '#^Call to function is_array\(\) with non\-empty\-array will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType + count: 1 + path: ../../Classes/Core/Functional/Framework/Constraint/RequestSection/HasRecordConstraint.php + + - + message: '#^Call to static method PHPUnit\\Framework\\Assert\:\:assertTrue\(\) with true will always evaluate to true\.$#' + identifier: staticMethod.alreadyNarrowedType + count: 1 + path: ../../Classes/Core/Functional/FunctionalTestCase.php + + - + message: '#^Strict comparison using \!\=\= between int\|string\|true and false will always evaluate to true\.$#' + identifier: notIdentical.alwaysTrue + count: 1 + path: ../../Classes/Core/Functional/FunctionalTestCase.php diff --git a/Build/phpunit/UnitTests.xml b/Build/phpunit/UnitTests.xml index e08a2226..e2cfe4a4 100644 --- a/Build/phpunit/UnitTests.xml +++ b/Build/phpunit/UnitTests.xml @@ -1,7 +1,6 @@ testDatabaseNameIsNotTooLong($originalDatabaseName, $localConfiguration); if ($dbDriver === 'mysqli' || $dbDriver === 'pdo_mysql') { $localConfiguration['DB']['Connections']['Default']['charset'] = 'utf8mb4'; - $localConfiguration['DB']['Connections']['Default']['tableoptions']['charset'] = 'utf8mb4'; - $localConfiguration['DB']['Connections']['Default']['tableoptions']['collate'] = 'utf8mb4_unicode_ci'; + $localConfiguration['DB']['Connections']['Default']['defaultTableOptions']['charset'] = 'utf8mb4'; + $localConfiguration['DB']['Connections']['Default']['defaultTableOptions']['collation'] = 'utf8mb4_unicode_ci'; } } else { // sqlite dbs of all tests are stored in a dir parallel to instance roots. Allows defining this path as tmpfs. diff --git a/Classes/Core/Functional/FunctionalTestCase.php b/Classes/Core/Functional/FunctionalTestCase.php index 7f0667e9..c755344f 100644 --- a/Classes/Core/Functional/FunctionalTestCase.php +++ b/Classes/Core/Functional/FunctionalTestCase.php @@ -615,6 +615,10 @@ protected function assertCSVDataSet(string $fileName): void $hasHashField = ($dataSet->getHashIndex($tableName) !== null); $records = $this->getAllRecords($tableName, $hasUidField, $hasHashField); $assertions = $dataSet->getElements($tableName); + if (count($assertions) === 0) { + // Increase assertion counter to avoid "test did not perform any assertions" if testing for an empty table + self::assertThat(true, self::isTrue()); + } foreach ($assertions as $assertion) { $result = $this->assertInRecords($assertion, $records); if ($result === false) { diff --git a/Classes/Core/Testbase.php b/Classes/Core/Testbase.php index cafd2a5f..4b848ccf 100644 --- a/Classes/Core/Testbase.php +++ b/Classes/Core/Testbase.php @@ -498,7 +498,7 @@ public function testDatabaseNameIsNotTooLong(string $originalDatabaseName, array } /** - * Create LocalConfiguration.php file of the test instance. + * Create settings.php file of the test instance. * For functional and acceptance tests. * * @param non-empty-string $instancePath Absolute path to test instance @@ -513,8 +513,9 @@ public function setUpLocalConfiguration(string $instancePath, array $configurati $finalConfigurationArray = require $coreExtensionPath . '/Configuration/FactoryConfiguration.php'; $finalConfigurationArray = array_replace_recursive($finalConfigurationArray, $configuration); $finalConfigurationArray = array_replace_recursive($finalConfigurationArray, $overruleConfiguration); + $this->createDirectory($instancePath . '/typo3conf/system'); $result = @file_put_contents( - $instancePath . '/typo3conf/LocalConfiguration.php', + $instancePath . '/typo3conf/system/settings.php', '