Hi everybody,
I have a created a Neos package in a single Git repository to include in multiple Neos projects. My packages does contain some PHP code, which I would like to test. I already have created unit and functional tests based on neos/buildessentials
for packages which are in the same repository as one of my Neos projects. That’s not the point of this topic.
My proplem/question explicitly is about how to test packages in standalone repositories. I already have an solution for unit test. With the following lines in my packages composer.json
…
"require-dev": {
"neos/buildessentials": "^7.3",
"phpunit/phpunit": "^9.0",
"mikey179/vfsstream": "2.0.x-dev"
},
"config": {
"vendor-dir": "Packages/Libraries",
"bin-dir": "bin",
"allow-plugins": {
"neos/composer-plugin": true
}
}
… I easily can execute composer install
and bin/phpunit -c Build/tests/UnitTests.xml
and my unit tests work.
But this is the end of my knowledge and I would need some help:
- How could I execute functional tests in my standalone package?
- Are there any examples or best practices?
My first idea was to configure some additional composer scripts to create a more realistic folder structure:
"scripts": {
"pre-install-cmd": [
"mkdir -p Packages/Application/My.Package",
"cp -a Classes Configuration Migrations Resources composer.json Packages/Application/My.Package/"
],
"post-install-cmd": [
"Neos\\Flow\\Composer\\InstallerScripts::postUpdateAndInstall"
]
}
But it feels so wrong that I would like to ask, if there are better concepts. Or am I totally wrong and nobody except me wants to execute functional tests for a package?