Skip to content

Tags: TYPO3/testing-framework

Tags

9.1.2

[TASK] Allow defining test instance files copy for acceptance tests

Running acceptance tests with codeception on a created
test instance with a real `Apache2` webserver requires
to have the `.htaccess` files in place, otherwise the
required rewriting to the endpoints will not work.

Since TYPO3 v13 with droppend backend entrypoint this
grows to a even higher requirement.

TYPO3 monorepo implemented that directly within the
extended `BackendEnvironment` class.

To make the live for developers easier using the
`typo3/testing-framework` for project or extension
acceptance testing a new tooling is now added based
on the direct monorepo implementation.

Following `BackendEnvironment::$config[]` options are
now available:

* `'copyInstanceFiles' => [],` (`array<string, string[]>`)
  to copy the soureFile to all listed target paths.
* `'copyInstanceFilesCreateTargetPath' => true,` to
  configure if target folders should be created when
  missing or throw a excetion.

`BackendEnvironment` applies default files to copy based on
available core extensions:

* `EXT:backend`
  source.: 'typo3/sysext/backend/Resources/Public/Icons/favicon.ico'
  targets:
    - 'favicon.ico'

* `EXT:install`
  source.: 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/root-htaccess'
  targets:
    - '.htaccess'

  source.: 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-htaccess'
  targets:
    - 'fileadmin/_temp_/.htaccess'

  source.: 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-index.html'
  targets:
   - 'fileadmin/_temp_/index.html'

  source.: 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/typo3temp-var-htaccess'
  targets:
    . 'typo3temp/var/.htaccess',

That way, additional files could be defined and configured
instead of implementing custom code in the extended class.

Note that files are always provided, which does not hurt
when not using `Apache2` as acceptance instance webserver.

Releases: main, 8

8.2.7

[TASK] Allow defining test instance files copy for acceptance tests

Running acceptance tests with codeception on a created
test instance with a real `Apache2` webserver requires
to have the `.htaccess` files in place, otherwise the
required rewriting to the endpoints will not work.

Since TYPO3 v13 with droppend backend entrypoint this
grows to a even higher requirement.

TYPO3 monorepo implemented that directly within the
extended `BackendEnvironment` class.

To make the live for developers easier using the
`typo3/testing-framework` for project or extension
acceptance testing a new tooling is now added based
on the direct monorepo implementation.

Following `BackendEnvironment::$config[]` options are
now available:

* `'copyInstanceFiles' => [],` (`array<string, string[]>`)
  to copy the soureFile to all listed target paths.
* `'copyInstanceFilesCreateTargetPath' => true,` to
  configure if target folders should be created when
  missing or throw a excetion.

`BackendEnvironment` applies default files to copy based on
available core extensions:

* `EXT:backend`
  source.: 'typo3/sysext/backend/Resources/Public/Icons/favicon.ico'
  targets:
    - 'favicon.ico'

* `EXT:install`
  source.: 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/root-htaccess'
  targets:
    - '.htaccess'

  source.: 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-htaccess'
  targets:
    - 'fileadmin/_temp_/.htaccess'

  source.: 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/fileadmin-temp-index.html'
  targets:
   - 'fileadmin/_temp_/index.html'

  source.: 'typo3/sysext/install/Resources/Private/FolderStructureTemplateFiles/typo3temp-var-htaccess'
  targets:
    . 'typo3temp/var/.htaccess',

That way, additional files could be defined and configured
instead of implementing custom code in the extended class.

Note that files are always provided, which does not hurt
when not using `Apache2` as acceptance instance webserver.

Releases: main, 8

9.1.1

[BUGFIX] Enforce classic mode in created TYPO3 entrypoint files

`typo3/testing-framework` provides a extended `SystemEnvironmentBuilder`
to ensure correct instance initialization as classic mode in different
test context environment, allowing to manual set the composer mode flag
despite having the PHP define from parent composer installation as source.

`Testbase->setUpInstanceCoreLinks()` additionally provides TYPO3 entrypoints
in form of index.php files, calling the basic bootstrap, based on template
files from system extensions and modified to use the `typo3/testing-framework`
`SystemEnvironmentBuilder` but does not enforce non-composer (classic) mode.
This does not hurt within functional tests but codeception based accceptance
instances misses the enforced classic mode which can lead to several issues,
for example normalizedParams path calculation as basis for additional path
or link generation.

This change modifies the entrypoint creation code to reflect this need and
forces non-composer mode.

Releases: main, 8

8.2.6

[BUGFIX] Enforce classic mode in created TYPO3 entrypoint files

`typo3/testing-framework` provides a extended `SystemEnvironmentBuilder`
to ensure correct instance initialization as classic mode in different
test context environment, allowing to manual set the composer mode flag
despite having the PHP define from parent composer installation as source.

`Testbase->setUpInstanceCoreLinks()` additionally provides TYPO3 entrypoints
in form of index.php files, calling the basic bootstrap, based on template
files from system extensions and modified to use the `typo3/testing-framework`
`SystemEnvironmentBuilder` but does not enforce non-composer (classic) mode.
This does not hurt within functional tests but codeception based accceptance
instances misses the enforced classic mode which can lead to several issues,
for example normalizedParams path calculation as basis for additional path
or link generation.

This change modifies the entrypoint creation code to reflect this need and
forces non-composer mode.

Releases: main, 8

9.1.0

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
[TASK] Do not assertX but fail() in tearDown() (#660)

phpunit has a best practice that tests should usually
have at least one assertion to be sure they actually
do something. All assertions thus raise a counter that
is checked after test execution. If zero, phpunit marks
the test risky with "test has no assertion".

There are two ways to suppress this:
* Setting beStrictAboutTestsThatDoNotTestAnything="false"
  via phpunit config
* Adding #[DoesNotPerformAssertions] attribute to single
  tests to actively mark tests that do not assert something
  as legit

Our abstract UnitTestCase spoils this by always doing
assertions in tearDown(). The patch turns these
assertions into check+fail() code instead. Unit tests that
don't have assertions for whatever reason are now properly
marked as risky as intended by phpunit.

Releases: main

9.0.3

[TASK] Do not enable feature `redirects.hitCount` for acceptance tests

This change removes the enabling of feature `redirects.hitCount`
within codeception acceptance test setups to stay on TYPO3 Core
defaults.

That has been preared with temporary solution for TYPO3 Core tests [1].

* [1] https://review.typo3.org/c/Packages/TYPO3.CMS/+/87280

Resolves: #554
Releases: main

8.2.5

[BUGFIX] Ensure to take test instance as class mode instance

The bugfix backport to ensure correct system environment path
building to fix issue #577 missed to correctly set the flag
for non-composer mode for TYPO3 v12 and lead to wrong path
calculations and followup issues within functional tests.

This is fixed by handing over a correct override value within
the functional test bootstrap.

[1] #577
[2] #633

Resolves: #658
Related: #633
Related: 409c2b8
Releases: 8

8.2.4

[BUGFIX] Avoid TypeError for database port handling

Using the `typo3DatabasePort` environment variable to
define the database server port string-casts the value
to an string which is not compatible with the mysqli
method `mysqli::real_connect()` and fails with:

  TypeError: mysqli::real_connect(): Argument #5 ($port)
  must be of type ?int, string given

This change casts the database port to an integer in case
a port is provided to avoid PHP TypeError when passing to
`mysqli::real_connect()` to align with `ConnectionPool`,
which is not used to create the database for the functional
test instance.

Resolves: #631
Releases: main, 8

9.0.2

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
[TASK] Trigger assertion in assertCSVDataSet() on empty table (#653)

When comparing with a csv fixture that contains a table
with no rows, which is a legit case, no assertion is
raised. This makes phpunit emit a risky test: "This test
did not perform any assertions". The patch adds an
assertion in this case as well.

Note phpunit nowadays has attribute #[DoesNotPerformAssertions]
to mark tests that do not assert anything. This can be used
for tests that for instance just call a subject method to verify
no exception is raised. It is good to follow this path, the
patch removes "beStrictAboutTestsThatDoNotTestAnything=false"
from the example phpunit xml files, which makes this setting
implicitly true.

Releases: main
Resolves: #647

9.0.1

[BUGFIX] Add missing parameter for `SystemEnvironmentBuilder::run()` …

…call

Related: #577
Releases: main