Skip to content
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

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

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

sbuerk
Copy link
Collaborator

@sbuerk sbuerk commented Dec 5, 2024

[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
Related: #663

@sbuerk sbuerk force-pushed the 8-codeception-htaccess branch from b53e9dc to cf142c9 Compare December 5, 2024 12:07
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
@sbuerk sbuerk force-pushed the 8-codeception-htaccess branch from cf142c9 to 0bf4970 Compare December 5, 2024 12:18
sbuerk added a commit to sbuerk/b13-container that referenced this pull request Dec 5, 2024
… instance

TYPO3 v13.0 dropped the backend entrypoint (`./typo3/index.php`)
and made the main entrypoint (`./index.php`) capable of handling
frontend and backend web requests to make the backend entrypoint
finally configurable and required to change the rewrite rules for
webservers to ensure backend requests hits the main entrypoint.

The acceptance setup for `b13/container` is based on the TYPO3
monorepo setup using a real `Apache2` webserver instead of the
PHP internal webserver and thus needs `.htaccess` rules to work.

Providing needed `.htaccess` files has been added to the TYPO3
monorepo only and broke the setup for acceptance testing against
TYPO3 v13. As a workaround providing the old backend entrypoint
file has been implemented within the extended codeception setup
method `BackendContainerEnvironment::bootstrapTypo3Environment()`
which worked but is literally wrong.

`typo3/testing-framework` now provides these files automatically,
and the wrong workaround can be removed to cleanup the code base
[1][2][3][4] and is backwards compatible for older TYPO3 versions.

One phpstan ignore pattern can be now removed from all baselines.

[1] TYPO3/testing-framework#663
[2] TYPO3/testing-framework#664
[3] ...
[4] ...
sbuerk added a commit to sbuerk/b13-container that referenced this pull request Dec 5, 2024
… instance

TYPO3 v13.0 dropped the backend entrypoint (`./typo3/index.php`)
and made the main entrypoint (`./index.php`) capable of handling
frontend and backend web requests to make the backend entrypoint
finally configurable and required to change the rewrite rules for
webservers to ensure backend requests hits the main entrypoint.

The acceptance setup for `b13/container` is based on the TYPO3
monorepo setup using a real `Apache2` webserver instead of the
PHP internal webserver and thus needs `.htaccess` rules to work.

Providing needed `.htaccess` files has been added to the TYPO3
monorepo only and broke the setup for acceptance testing against
TYPO3 v13. As a workaround providing the old backend entrypoint
file has been implemented within the extended codeception setup
method `BackendContainerEnvironment::bootstrapTypo3Environment()`
which worked but is literally wrong.

`typo3/testing-framework` now provides these files automatically,
and the wrong workaround can be removed to cleanup the code base
[1][2][3][4] and is backwards compatible for older TYPO3 versions.

One phpstan ignore pattern can be now removed from all baselines.

[1] TYPO3/testing-framework#663
[2] TYPO3/testing-framework#664
[3] ...
[4] ...
sbuerk added a commit to sbuerk/b13-container that referenced this pull request Dec 5, 2024
… instance

TYPO3 v13.0 dropped the backend entrypoint (`./typo3/index.php`)
and made the main entrypoint (`./index.php`) capable of handling
frontend and backend web requests to make the backend entrypoint
finally configurable and required to change the rewrite rules for
webservers to ensure backend requests hits the main entrypoint.

The acceptance setup for `b13/container` is based on the TYPO3
monorepo setup using a real `Apache2` webserver instead of the
PHP internal webserver and thus needs `.htaccess` rules to work.

Providing needed `.htaccess` files has been added to the TYPO3
monorepo only and broke the setup for acceptance testing against
TYPO3 v13. As a workaround providing the old backend entrypoint
file has been implemented within the extended codeception setup
method `BackendContainerEnvironment::bootstrapTypo3Environment()`
which worked but is literally wrong.

`typo3/testing-framework` now provides these files automatically,
and the wrong workaround can be removed to cleanup the code base
[1][2][3][4] and is backwards compatible for older TYPO3 versions.

Some phpstan ignore pattern can be now removed from baselines and
is done in the same run.

[1] TYPO3/testing-framework#663
[2] TYPO3/testing-framework#664
[3] ...
[4] ...
sbuerk added a commit to sbuerk/b13-container that referenced this pull request Dec 5, 2024
… instance

TYPO3 v13.0 dropped the backend entrypoint (`./typo3/index.php`)
and made the main entrypoint (`./index.php`) capable of handling
frontend and backend web requests to make the backend entrypoint
finally configurable and required to change the rewrite rules for
webservers to ensure backend requests hits the main entrypoint.

The acceptance setup for `b13/container` is based on the TYPO3
monorepo setup using a real `Apache2` webserver instead of the
PHP internal webserver and thus needs `.htaccess` rules to work.

Providing needed `.htaccess` files has been added to the TYPO3
monorepo only and broke the setup for acceptance testing against
TYPO3 v13. As a workaround providing the old backend entrypoint
file has been implemented within the extended codeception setup
method `BackendContainerEnvironment::bootstrapTypo3Environment()`
which worked but is literally wrong.

`typo3/testing-framework` now provides these files automatically,
and the wrong workaround can be removed to cleanup the code base
[1][2][3][4] and is backwards compatible for older TYPO3 versions.

Some phpstan ignore pattern can be now removed from baselines and
is done in the same run.

[1] TYPO3/testing-framework#663
[2] TYPO3/testing-framework#664
[3] ...
[4] ...
@sbuerk sbuerk added the backport label Dec 5, 2024
@sbuerk sbuerk merged commit 7396ef0 into 8 Dec 5, 2024
8 checks passed
@sbuerk sbuerk deleted the 8-codeception-htaccess branch December 5, 2024 15:42
sbuerk added a commit to sbuerk/b13-container that referenced this pull request Dec 5, 2024
…ance

TYPO3 v13.0 dropped the backend entrypoint (`./typo3/index.php`)
and made the main entrypoint (`./index.php`) capable of handling
frontend and backend web requests to make the backend entrypoint
finally configurable and required to change the rewrite rules for
webservers to ensure backend requests hits the main entrypoint.

The acceptance setup for `b13/container` is based on the TYPO3
monorepo setup using a real `Apache2` webserver instead of the
PHP internal webserver and thus needs `.htaccess` rules to work.

Providing needed `.htaccess` files has been added to the TYPO3
monorepo only and broke the setup for acceptance testing against
TYPO3 v13. As a workaround providing the old backend entrypoint
file has been implemented within the extended codeception setup
method `BackendContainerEnvironment::bootstrapTypo3Environment()`
which worked but is literally wrong.

`typo3/testing-framework` now provides these files automatically,
and the wrong workaround can be removed to cleanup the code base
[1][2][3][4] and is backwards compatible for older TYPO3 versions.

Some phpstan ignore pattern can be now removed from baselines and
is done in the same run.

[1] TYPO3/testing-framework#663
[2] TYPO3/testing-framework#664
[3] /~https://github.com/TYPO3/testing-framework/releases/tag/9.1.2
[4] /~https://github.com/TYPO3/testing-framework/releases/tag/8.2.7
achimfritz pushed a commit to b13/container that referenced this pull request Dec 5, 2024
…ance

TYPO3 v13.0 dropped the backend entrypoint (`./typo3/index.php`)
and made the main entrypoint (`./index.php`) capable of handling
frontend and backend web requests to make the backend entrypoint
finally configurable and required to change the rewrite rules for
webservers to ensure backend requests hits the main entrypoint.

The acceptance setup for `b13/container` is based on the TYPO3
monorepo setup using a real `Apache2` webserver instead of the
PHP internal webserver and thus needs `.htaccess` rules to work.

Providing needed `.htaccess` files has been added to the TYPO3
monorepo only and broke the setup for acceptance testing against
TYPO3 v13. As a workaround providing the old backend entrypoint
file has been implemented within the extended codeception setup
method `BackendContainerEnvironment::bootstrapTypo3Environment()`
which worked but is literally wrong.

`typo3/testing-framework` now provides these files automatically,
and the wrong workaround can be removed to cleanup the code base
[1][2][3][4] and is backwards compatible for older TYPO3 versions.

Some phpstan ignore pattern can be now removed from baselines and
is done in the same run.

[1] TYPO3/testing-framework#663
[2] TYPO3/testing-framework#664
[3] /~https://github.com/TYPO3/testing-framework/releases/tag/9.1.2
[4] /~https://github.com/TYPO3/testing-framework/releases/tag/8.2.7
reviewtypo3org pushed a commit to TYPO3/typo3 that referenced this pull request Dec 6, 2024
Update `typo3/testing-framework` to ensure having latest
changes available and prepare for removing a temporary
solution added with #103297 and remove duplicated code
from codeception environment setup class which is now
provided with the new `typo3/testing-framework` releases
[1][2] containing [3][4][5].

Following updates are made depending on TYPO3 branch:

* main: update typo3/testing-framework:dev-main [5]
* 13.4: Require typo3/testing-framework:9.1.2 [3]
* 12.4: Require typo3/testing-framework:8.2.7 [4]

Used command(s):

> sed -i 's/typo3\/testing-framework:^9.0.3/typo3\/testing-framework:^9.1.2/g' \
  Build/Scripts/setupAcceptanceComposer.sh
> composer require --no-update \
    -d Build/tests/packages/dataset_import \
    typo3/testing-framework:^9.1.2
> composer require --dev typo3/testing-framework:^9.1.2

Removing of temporary solution and duplicated code will
be handled with dedicated followup changes.

[1] /~https://github.com/TYPO3/testing-framework/releases/tag/9.1.2
[2] /~https://github.com/TYPO3/testing-framework/releases/tag/8.2.7
[3] TYPO3/testing-framework#663
[4] TYPO3/testing-framework#664
[5] TYPO3/testing-framework@e9c3bc4

Resolves: #105775
Related: #103297
Releases: main, 13.4, 12.4
Change-Id: I07b8cb50fae5967d6726c43c489ea1abd6fbea49
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/87384
Tested-by: core-ci <typo3@b13.com>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: Garvin Hicking <gh@faktor-e.de>
Reviewed-by: Garvin Hicking <gh@faktor-e.de>
reviewtypo3org pushed a commit to TYPO3/typo3 that referenced this pull request Dec 6, 2024
Update `typo3/testing-framework` to ensure having latest
changes available and prepare for removing a temporary
solution added with #103297 and remove duplicated code
from codeception environment setup class which is now
provided with the new `typo3/testing-framework` releases
[1][2] containing [3][4][5].

Following updates are made depending on TYPO3 branch:

* main: update typo3/testing-framework:dev-main [5]
* 13.4: Require typo3/testing-framework:9.1.2 [3]
* 12.4: Require typo3/testing-framework:8.2.7 [4]

Used command(s):

> composer update typo3/testing-framework

Removing of temporary solution and duplicated code will
be handled with dedicated followup changes.

[1] /~https://github.com/TYPO3/testing-framework/releases/tag/9.1.2
[2] /~https://github.com/TYPO3/testing-framework/releases/tag/8.2.7
[3] TYPO3/testing-framework#663
[4] TYPO3/testing-framework#664
[5] TYPO3/testing-framework@e9c3bc4

Resolves: #105775
Related: #103297
Releases: main, 13.4, 12.4
Change-Id: I07b8cb50fae5967d6726c43c489ea1abd6fbea49
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/87383
Tested-by: Benni Mack <benni@typo3.org>
Tested-by: Andreas Kienast <akienast@scripting-base.de>
Reviewed-by: Garvin Hicking <gh@faktor-e.de>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Tested-by: core-ci <typo3@b13.com>
Tested-by: Garvin Hicking <gh@faktor-e.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Andreas Kienast <akienast@scripting-base.de>
reviewtypo3org pushed a commit to TYPO3/typo3 that referenced this pull request Dec 6, 2024
Update `typo3/testing-framework` to ensure having latest
changes available and prepare for removing a temporary
solution added with #103297 and remove duplicated code
from codeception environment setup class which is now
provided with the new `typo3/testing-framework` releases
[1][2] containing [3][4][5].

Following updates are made depending on TYPO3 branch:

* main: update typo3/testing-framework:dev-main [5]
* 13.4: Require typo3/testing-framework:9.1.2 [3]
* 12.4: Require typo3/testing-framework:8.2.7 [4]

Used command(s):

> sed -i 's/typo3\/testing-framework:^8.2.4/typo3\/testing-framework:^8.2.7/g' \
  Build/Scripts/setupAcceptanceComposer.sh
> composer require --no-update \
    -d Build/tests/packages/dataset_import \
    typo3/testing-framework:^8.2.7
> composer require --dev typo3/testing-framework:^8.2.7

Removing of temporary solution and duplicated code will
be handled with dedicated followup changes.

[1] /~https://github.com/TYPO3/testing-framework/releases/tag/9.1.2
[2] /~https://github.com/TYPO3/testing-framework/releases/tag/8.2.7
[3] TYPO3/testing-framework#663
[4] TYPO3/testing-framework#664
[5] TYPO3/testing-framework@e9c3bc4

Resolves: #105775
Related: #103297
Releases: main, 13.4, 12.4
Change-Id: I07b8cb50fae5967d6726c43c489ea1abd6fbea49
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/87385
Tested-by: core-ci <typo3@b13.com>
Reviewed-by: Stefan Bürk <stefan@buerk.tech>
Reviewed-by: Garvin Hicking <gh@faktor-e.de>
Tested-by: Garvin Hicking <gh@faktor-e.de>
Tested-by: Stefan Bürk <stefan@buerk.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant