1.

Record Nr.

UNINA9910458322303321

Autore

Machek Zdenek

Titolo

PHPUnit essentials : get started with PHPUnit and learn how to write and test code using advanced technologies / / Zdenek Machek ; cover image by Asher Wishkerman

Pubbl/distr/stampa

Birmingham, England : , : Packt Publishing, , 2014

©2014

ISBN

1-78328-344-0

Edizione

[1st edition]

Descrizione fisica

1 online resource (314 p.)

Collana

Community Experience Distilled

Disciplina

005.1

Soggetti

Application software - Development

Computer programming

JavaScript (Computer program language)

Electronic books.

Lingua di pubblicazione

Inglese

Formato

Materiale a stampa

Livello bibliografico

Monografia

Note generali

Includes index.

Nota di contenuto

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

PHP-SeleniumClient

Sommario/riassunto

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 who have experience with PHP and who want to take their coding skills to another level. Developers who have previous experience with PHPUnit will find interesting chapters concerning PHPUnit in the context of web application development.