Testing usando PHPUNIT COMPOSER REQUIRE PHPUNIT/PHPUNIT --DEV
WWW.RAULGARCIA.NAME
|
WWW.FACEBOOK.COM/ISERAULGARCIA
Introducci贸n PHPUnit is a unit testing framework for the PHP programming language. It is an instance of the xUnit architecture for unit testing frameworks that originated with SUnit and became popular with JUnit. PHPUnit was created by Sebastian Bergmann and its development is hosted on GitHub.
PHPUnit is based on of the idea that developers should be able to find mistakes in their newlycommitted code quickly and assert that no code regression has occurred in other parts of the code base. Much like other unit testing frameworks, PHPUnit usesassertions to verify that the behavior of the specific component - or "unit" - being tested behaves as expected.
Fuente: Wikipedia
Requerimientos Contar con Composer http://issuu.com/pmraulgarcia/docs/composer_en_windows
Instalaci贸n
WWW.RAULGARCIA.NAME
|
WWW.FACEBOOK.COM/ISERAULGARCIA
Comprobaci贸n
WWW.RAULGARCIA.NAME
|
WWW.FACEBOOK.COM/ISERAULGARCIA
Alternativa a la Terminal de Windows http://sourceforge.net/projects/conemu/files/Preview/
WWW.RAULGARCIA.NAME
|
WWW.FACEBOOK.COM/ISERAULGARCIA
La Clase User y la Subclase Admin Probar utilizando PHPUNIT
Estructura de Carpetas
Clase User ◦ Atributos ◦ protected email ◦ protected password ◦ protected firstName ◦ protected lastName
◦ Métodos ◦ constructor() ◦ setName() ◦ getFirstName() ◦ getLastName() ◦ getEmail()
Clase Admin Heredar: User
Métodos ◦ constructor() ◦ getPassword()
Clase Prueba UserTest Heredar: PHPUnit_Framework_TestCase
Métodos ◦ ◦ ◦ ◦ ◦
user_constructor() test_firstName() test_lastName_beginning() test_userEmail() validate_return()
Clase Prueba AdminTest Heredar: PHPUnit_Framework_TestCase
Métodos ◦ user_constructor() ◦ test_getPasswordAdmin() ◦ test_getEmailUser()
Ubicarse en la Carpeta de phpunit cd /Xampp/htdocs/phpunit01/vendor/bin
Probando la Clase User y la Subclase Admin phpunit ../../tests --colors="auto"
Anexo Pantallas ejemplo Completo desde la instalaci贸n de composer, instalaci贸n de phpunit y prueba de la clase y la subclase.