Unit Testing - Akif1080/Virtual-Shop-Management-System- GitHub Wiki
PHPUnit
PHPUnit is a framework independent library for unit testing PHP. Unit testing is a method by which small units of code are tested against expected results. With unit testing we test each component of the code individually. All components can be tested at least once. A major advantage of this approach is that it becomes easier to detect bugs early on. The small scope means it is easier to track down the cause of bugs when they occur.
Installing PHPUnit on Ubuntu
- First of all go to the Windows cmd and tranform is to Ubuntu cmd by giving command "bash". First you have to check that your device has Ubuntu installed earlier on windows, if not then follow the link https://www.youtube.com/watch?v=X-DHaQLrBi8
- After going from Windows cmd to Ubuntu cmd as you installed php earlier, now install the phpunit tool in a easiest way by 2 commands on Ubuntu cmd. "$ sudo apt-get update -y" "$ sudo apt-get install -y phpunit" For more https://zoomadmin.com/HowToInstall/UbuntuPackage/phpunit
- After that run command to know the phpunit version from installation confirmation "$ phpunit --version" 4.Go to the test file directory and run the test file by the command : "$ phpunit --verbose test.php" where test denotes the file name. Then you will get the function testing output which defines if the function works correctly or not.