PHP Classes

How to Develop a PHP Unite Test Class to Test the features of a PHP Learning from the Example Package PHP Unit Testing Sample: Show how to test a class using PHPUnit

Recommend this page to a friend!
  Info   View files Documentation   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2024-07-26 (21 hours ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
php-unit-testing-sam 1.0The PHP License7Language, Testing, PHP 7
Description 

Author

This package can show how to test a class using PHPUnit.

It provides a simple class that models a user with a given name, age, and favorite color.

The package also provides a class that can test the features of the user class using the PHPUnit test case class.

This demonstrates how to perform php code unit testing using PHPUnit dependency

Picture of Okanlawon Anuoluwapo
  Performance   Level  
Name: Okanlawon Anuoluwapo <contact>
Classes: 6 packages by
Country: Nigeria Nigeria
Innovation award
Innovation award
Nominee: 3x

Documentation

Test app sample

Writing php unit testing with phpunit

Run composer require to install all missing dependencies

Then, to test: run below line in terminal specifying the file-path or directory name:

    ./vendor/bin/phpunit

Example:

    ./vendor/bin/phpunit tests
    ./vendor/bin/phpunit tests/UserTest.php

  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Files folder imagetests (1 file)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file composer.lock Data Auxiliary data
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Plain text file User.php Class Class source

  Files folder image Files  /  tests  
File Role Description
  Plain text file UserTest.php Class Class source

 Version Control Unique User Downloads  
 100%
Total:0
This week:0