Book Image

PHPUnit Essentials

By : Zdenek Machek
Book Image

PHPUnit Essentials

By: Zdenek Machek

Overview of this book

<p>The ability to write unit tests and software testing have become skills that every PHP developer should master.<br /><br />This book is a practical guide to PHPUnit and unit testing, covering all aspects of writing PHPUnit tests and using them. The book shows why testable code is better code and how to write good tests with the help of simple and easy-to-understand examples.<br /><br />With this book, you will learn how to write, organize, and execute effective tests. Step-by-step techniques of how to write testable code, how to refactor the code, and how to run your tests are shown. You will also learn about advanced testing techniques, including how to test databases, APIs, and legacy code. PHPUnit Essentials is a guide for PHP developers who want to learn or improve their software testing skills. It is a book for developers who begin with testing but is also a good source of information for developers who are already familiar with PHPUnit.</p>
Table of Contents (21 chapters)
PHPUnit Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
5
Running Tests from the Command Line
Index

About the Reviewers

R. Rajesh Jeba Anbiah has been into programming since 1998 with C, Visual Basic, Delphi, Perl, PHP, ASP.NET MVC, and Play. He currently heads the project division in Agriya (http://www.agriya.com/), where he oversees challenging web and mobile development projects, web software products, and lab initiatives. These days, he's more passionate about topics related to machine learning and REST-based SPA using Node.js, AngularJS, and upcoming frameworks.

So far he has authored two books:

  • A to Z of C, Packt Publishing

  • PHP Ajax Cookbook, Packt Publishing

When he's not in the office, he is mostly available at home nagging his wife and two children.

Azizur Rahman is a senior web developer at the BBC. Currently, he's working on the BBC Homepage project. He has a BSc (Hons) Artificial Intelligence degree from the University of Westminster, UK.

He joined BBC in late 2011 as a web application developer within the Future Media Knowledge and Learning department. While working on the Knowledge & Learning project (http://www.bbc.co.uk/education), he put his knowledge of Test-Driven Development (TDD) using PHPUnit into practice. In this large scale project, the development team also used Ruby and Cucumber for fully automated acceptance testing.

The Knowledge & Learning project's purpose was to bring together factual and learning content from over 100 existing BBC websites, from Bitesize, Food, Science to History, and place them into a single consistent user experience designed to make learning feel effortless and delightful.

After the successful launch of the Knowledge & Learning project, he moved to the Interactive Guides project (http://www.bbc.co.uk/guides). While developing Interactive Guides, he solidified and advanced his knowledge of TDD and Behavior-Driven Development (BDD).

The Interactive Guides project took a different approach to presenting content compared to traditional web articles of TV and radio programs online. They organize video and audio, rich infographics, written summaries, and activities into stories that make the most out of BBC's interactive medium. Interactive Guides takes the audience through a series of steps that ask them to look at multiple perspectives of intriguing questions, always with the chance to reflect on the significance of the story at the end.

A firm believer in philanthropy, Azizur spends his spare time supporting philanthropic causes using his knowledge and expertise of open source technologies.

He serves as a senior web developer / IT advisor to ProductiveMuslim.com—a website dedicated to Islam and productivity. A global team of volunteers with the sole aim to help the Ummah ("nation" or "community") become productive again!

The following is a quote by Prophet Muhammad (PBUH) taken from http://sunnah.com/urn/1252420:

"The best of charity is when a [Muslim] man gains knowledge, then he teaches it to his [Muslim] brother."

In April 2014, he became an ambassador of STEMNET. As an ambassador, he uses his enthusiasm and commitment to encourage young people to enjoy science, technology, engineering, and mathematics. You can read more about STEMNET at http://www.stemnet.org.uk.

Along with technically reviewing this book, he has also technically reviewed PHP Application Development with NetBeans: Beginner's Guide, Packt Publishing.

His keen interest in open source software makes him a regular attendee at local technology user groups and wider open source community events.

Mauro Takeda has been working in the IT industry since 1999 when he faced his first legacy problem: the Y2K bug. Since then, he has worked with several programming languages, such as COBOL, Dataflex, C, Visual Basic, Delphi, Pascal, Lisp, Prolog, and Java with whom he has a relationship of over 10 years. His newer passion is functional programming.

In the last five years, he has worked in CI&T (www.ciandt.com), a global IT company headquartered in Campinas, Brazil (a prominent tech center considered as the Brazilian Silicon Valley) with strategic locations across Latin America, North America, Europe, and the Asia-Pacific. Nowadays, as a systems architect, he is responsible for people and software development, mainly in PHP and Drupal.

Jakub Tománek is a seasoned (more than eight years' experience) PHP developer. After having started working on regular websites, he quickly focused on complex web applications, including creating APIs, background jobs, vast databases, and fixing untraceable bugs.

He currently works as a Senior Software Development Engineer in Microsoft, where his team maintains and improves Skype's website.

M. A. Hossain Tonu, the author of the book PHP Application Development with NetBeans: Beginner's Guide, Packt Publishing, graduated in Computer Science and Engineering from the Dhaka University of Engineering and Technology (DUET) in Bangladesh.

He is working at Vantage, Dhaka (http://www.vantage.com/), where he is leading and maintaining a highly available SAAS platform Vantage CRM that is the single most intuitive and easy-to-use Customer Relationship Management system (http://www.vantageip.com/products-services/vantage-crm/) on the market.

He has been a passionate developer for the past eight years, and has developed a series of web applications, services, and solutions for leading software companies in the country, such as somewherein and Improsys.

You can reach Tonu at and at his tech blog at http://mahtonu.wordpress.com.

Aaron Saray knows exactly what it's like to have code under the microscope. PHP conference presentations, open source contributions, and managing a team that now works in his old code, are things that have made him used to the constant code reviews. While he enjoys learning the newest in web technologies, more than a decade later, his true passion is still the core and basics of PHP programming, testing, and best practices. He reflects this in his WROX book Professional PHP Design Patterns and his technical blog at aaronsaray.com/blog. Additionally, he can be found as a technical editor of many books encompassing PHP, JavaScript, and Internet technologies.

Dmytro Zavalkin has around seven years of experience in the field of Web Development using LAMP stack. For the last three years, he has been using PHPUnit in his everyday work. Currently, he works as a PHP/Magento developer at AOE GmbH, Wiesbaden, Germany. Before relocating to Germany, he worked at Magento, an eBay Inc. company in Donetsk, Ukraine.