buttonmen-dev / buttonmen

Buttonmen - an online dice game
Other
16 stars 24 forks source link

phpunit tests should test contents of error_log #2898

Open cgolubi1 opened 1 year ago

cgolubi1 commented 1 year ago

We had a situation in https://github.com/buttonmen-dev/buttonmen/pull/2722 in which the unit tests started logging additional errors via error_log, which was a regression, but we didn't notice until manual testing turned up the issue.

phpunit tests should capture everything logged via error_log(), and fail if what is logged is unexpected.

cgolubi1 commented 1 year ago

Seems like you can redefine error_log() see e.g. https://stackoverflow.com/questions/31637068/testing-error-log-with-phpunit so this shouldn't be too hard.