Cargando…

PHPUnit Essentials.

This book is a practical guide featuring a step-by-step approach that aims to help PHP developers who want to learn or improve their software testing skills. It also takes you through many real-life examples encountered by PHP developers to help you avoid common pitfalls. This book is for developers...

Descripción completa

Detalles Bibliográficos
Clasificación:Libro Electrónico
Autor principal: Machek, Zdenek
Formato: Electrónico eBook
Idioma:Inglés
Publicado: Birmingham : Packt Publishing, 2014.
Colección:Community experience distilled.
Temas:
Acceso en línea:Texto completo
Tabla de Contenidos:
  • Cover; Copyright; Credits; About the Author; About the Reviewers; www.PacktPub.com; Table of Contents; Preface; Chapter 1: Installing PHPUnit; Requirements; Running PHP from the command line; Composer
  • the dependency manager for PHP; Installing Composer; Installation; Local installation; System-wide installation; Installing PEAR; Installing PHPUnit; Other installation methods; Installing the Linux package; Manual installation; Testing the installation; Xdebug; Installing Xdebug; Summary; Chapter 2: PHPUnit Support in IDEs; IDEs and PHPUnit; NetBeans; Zend Studio; Eclipse PDT.
  • Installing MakeGoodCreating your FirstTest; PhpStorm; Summary; Chapter 3: Tests and What They're All About; Understanding unit testing; What is a unit test?; Assertions; The importance of unit testing; Testing all possible scenarios; What makes a good test?; When to write tests; Anatomy of a PHPUnit test; Defining test methods; Testing functions; Testing methods; The MVC application architecture and tests; Testing controllers; Summary; Chapter 4: Testing Dependencies and Exceptions; Detecting dependencies; Handling dependencies; Exceptions are expected; Testing errors and exceptions; Summary.
  • Chapter 5: Running Tests from the Command LineRunning tests; Processing test results; Test statuses; Command-line switches; Logging results; Code coverage; Including and excluding tests from the execution; When to stop the test execution; Configuration options; Code coverage analysis; Summary; Chapter 6: Test Isolation and Interaction; Test fixtures; Before and after each test method; Before and after each test suite class; Global state; Test dependencies; Data providers; Summary; Chapter 7: Organizing Tests; The PHPUnit XML configuration file; Test listeners; Configuring the code coverage.
  • Where to store testsTest suites; Groups; Using the bootstrap file; Summary; Chapter 8: Using Test Doubles; Creating test doubles; Test doubles in action; Using fake; Using stubs; Using mocks and expectations; Test proxies; Understanding Mockery; Installation methods; Comparing Mockery to PHPUnit; How to use Mockery; Summary; Chapter 9: Database Testing; Which database to use; Tests for a database; DBUnit; Installing DBUnit; Database test cases; Datasets; Using DBUnit; Doctrine 2 ORM and database testing; Summary; Chapter 10: Testing APIs; An example of integration testing.
  • Testing the PayPal APITesting the Facebook API; Testing the Twitter API; Testing the service-oriented architecture; Summary; Chapter 11: Testing Legacy Code; Testing spaghetti code; Black box testing; Using Reflection; Handling dependencies; The Patchwork library; The vfsStream library; The runkit PHP extension; Summary; Chapter 12: Functional Tests in the Web Browser Using Selenium; Installing Selenium; The Selenium IDE; The Selenium Server; Installing drivers; The PHPUnit Selenium extension; Testing in the browser; Recording Selenium tests; PHPUnit Selenium2TestCase; Writing Selenium tests.