Hi Otto,
Welcome on the PHP SIG.
Le 19/07/2021 à 21:04, Otto Urpelainen a écrit :
There is one more field where I would like to see improvement: Test execution. The two projects I have been looking at this far have both used a system where the source actually includes tests, but they are stripped from Git archived through .gitattributes. In case this was not just a coincidence and such stripping is common for php projects, it would be great if there was a way to grab those test cases anyhow and execute them. I have not been able to find a way yet.
Nearly all the php-* packages are affected by this common terrible practice. You have to use a git snapshot. Please see any package which have a makesrc.sh or %{name}-get-sources.sh script.
Ex:
https://src.fedoraproject.org/rpms/php-laminas-escaper/blob/rawhide/f/makesr...
And
https://src.fedoraproject.org/rpms/php-laminas-escaper/blob/rawhide/f/php-la...
I also wonder if something like %py3_check_import [4] would be useful for cases where there are no real tests to run? The idea there is to run a program that imports the library, but does not do anything, just to catch those cases where the import itself fails, rendering the package library completely unusable.
As we usually add an autoloader (recommended), at least it needs to be tested.
Ex: https://src.fedoraproject.org/rpms/php-psr-cache/blob/rawhide/f/php-psr-cach...
This ensure one of class/interface provided by the library is found.
For compiled languages this is not so important, since compilation usually fails if things are totally broken.
Even for C extension a minimal "load" test is required, to ensure (at least) that all symbols are prooerly resolved (common error)
Remi