Instant Hands-on Testing with PHPUnit How-to [Instant]


This title is available as an eBook only
Instant Hands-on Testing with PHPUnit How-to [Instant]
eBook: $14.99
Formats: PDF, PacktLib, ePub and Mobi formats
$12.74
save 15%!
Print & eBook also available on:
Learn in an Instant - Short, Fast, Focused
Overview
Table of Contents
Author
Support
Sample Chapters
  • Learn something new in an Instant! A short, fast, focused guide delivering immediate results
  • Discover how to make best use of PHPUnit in your projects
  • Get started with code testing using PHPUnit in no time
  • Learn how to use PHPUnit like a seasoned veteran

Book Details

Language : English
eBook : 82 pages
Release Date : May 2013
ISBN : 178216958X
ISBN 13 : 9781782169581
Author(s) : Michael Lively
Topics and Technologies : All Books, Application Development, Instant, Open Source, PHP

Table of Contents

Preface
Instant Hands-on Testing with PHPUnit How-to
  • Instant Hands-on Testing with PHPUnit How-to
    • Installing PHPUnit (Simple)
    • Writing your first test (Simple)
    • Running tests (Simple)
    • Configuring PHPUnit (Simple)
    • Adding PHPUnit to your project (Simple)
    • Generating tests from code (Advanced)
    • Using test fixtures (Simple)
    • Using data providers (Intermediate)
    • Using test dependencies (Advanced)
    • Using mock objects (Simple)
    • Testing abstract classes (Intermediate)
    • Testing traits (Intermediate)
    • Testing exceptions and errors (Intermediate)
    • Testing output (Intermediate)
    • Testing protected and private methods (Intermediate)
    • Testing database interaction (Advanced)
    • Viewing code coverage (Advanced)

Michael Lively

Michael Lively has worked in a variety of roles in the software development industry for 12 years, from developer to architect and now a software development director. He has worked on a variety of different projects and a variety of different technologies over that time, from small home-grown sites serving a handful of regular users to large enterprise platforms serving millions of consumers. In addition to his professional work, he has been an active member of the PHP open source community. Some of his contributions include the database extension for PHPUnit and more recently an alternative mocking framework for PHP called Phake.

Sorry, we don't have any reviews for this title yet.

Code Downloads

Download the code and support files for this book.


Submit Errata

Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


Errata

- 1 submitted: last submission 24 Jan 2014

Errata category: Technical | Page Number: 24

Open tests/CardTest.php and add a new...

should be

Open test/CardTest.php and add a new...

Sorry, there are currently no downloads available for this title.

Frequently bought together

Instant Hands-on Testing with PHPUnit How-to [Instant] +    Voice Application Development for Android =
50% Off
the second eBook
Price for both: €20.60

Buy both these recommended eBooks together and get 50% off the cheapest eBook.

What you will learn from this book

  • Bootstrap PHPUnit into your project in a standard way
  • Understand the anatomy of a PHPUnit test
  • Create data providers to quickly create tests against multiple datasets
  • Use PHPUnit’s skeleton generator to generate code from tests or tests from code
  • Declare test dependencies to help isolate test failures
  • Test abstract classes, traits, and protected methods
  • Test database interactions in your unit tests

In Detail

No developer wants to accept the inherent difficulty of writing software as an excuse for not finding the bugs in our code before anyone else does. PHPUnit is a framework that was created to allow developers to solve that very problem. It provides a feature-rich environment with most of the tools necessary to provide adequate tests for any project.

"Instant Hands-on Testing with PHPUnit How-to" provides a thorough overview of the functionality provided by the PHPUnit framework. It shows how the plethora of features in the framework can be used to write tests for real world projects to ensure they function and will continue to function in the ways that you expect.

This book will show how you can set up the scaffolding necessary to run unit tests in your project with PHPUnit. It will walk you through the process of how to write a basic test and how to maintain your project’s test suite. You will learn how to use some of the more advanced features of PHPUnit and then see how you can use mock objects to isolate the code you are testing. We will then discover how to create tests that verify your interaction with databases and even see how you can use PHPUnit to understand which code you are actually testing.

At the end of the book you will have all of the basic understanding necessary to begin adding tests to your project. This book provides a great foundation for becoming a expert at writing unit tests.

Approach

Filled with practical, step-by-step instructions and clear explanations for the most important and useful tasks. This is a Packt Instant How-to guide, which provides concise and clear recipes for getting started with PHPUnit for performing code testing and improving code quality.

Who this book is for

"Instant Hands-on Testing with PHPUnit How-to" is for PHP developers that have an appreciation for writing accurate code. If you are new to PHPUnit, it will give you a solid foundation for understanding how to use PHPUnit to write tests for your projects. If you already have a cursory understanding of PHPUnit it will whet your appetite for some of the more difficult-to-understand concepts in PHPUnit.

Code Download and Errata
Packt Anytime, Anywhere
Register Books
Print Upgrades
eBook Downloads
Video Support
Contact Us
Awards Voting Nominations Previous Winners
Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
Resources
Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software