To install PHPUnit on Windows, you can follow the steps below:
Step 1: Install Composer
- Download and run the Composer installer for Windows from https://getcomposer.org/download/.
- Follow the instructions in the installer to complete the installation of Composer.
Step 2: Set up Composer
- Open the command prompt (CMD) or Git Bash.
- Verify that Composer is installed by running the command: composer --version. It should display the Composer version you installed.
Step 3: Install PHPUnit
- In the command prompt or Git Bash, navigate to the project directory where you want to install PHPUnit.
- Run the following command to install PHPUnit: composer require --dev phpunit/phpunit.
Step 4: Verify PHPUnit installation
- After the installation completes, try running the PHPUnit command to verify that it was installed successfully. Run the command: vendorinphpunit --version. It should display the PHPUnit version you installed.
That's it! PHPUnit is now installed on your Windows machine. You can use it for testing your PHP code.