Home > front end >  PHP unit testing without Composer
PHP unit testing without Composer

Time:01-29

Does anyone know of a basic unit testing framework for PHP that does not require Composer in order to use it? The project's testing requirements are simple, and I expect any framework would be fine. I'd be very happy with PHPUnit if there's a way of using that without Composer, though I don't think that's possible. The alternative is to roll my own, but I'd rather not do that unless it's necessary.

I know Composer is a perfectly good system, and if the decision were mine, we'd be using it. But it's not my decision, and it has been made clear that the project leader would rather not have any unit testing if the alternative is to use Composer. That's wholly irrational, I know, but it's not a battle I have time to fight.

CodePudding user response:

Actually, if you look at the installation docs, composer is not even stated as the preferred way to install PHPUnit.

The Phar version of PHPUnit can be used instead. It's easy to install and does not require composer.

To execute the tests, instead of a composer script, simply create a bash script (or cmd/powershell if you are on Windows). Although, depending on the configuration you use, it might also be as efficient to directly execute the phar.

  •  Tags:  
  • Related