Test-Driven PHP

12 Posts

Let's be honest: the PHP community hasn't been as quick to the test-driven development scene as other communities, such as those around the Ruby and Python languages. We hope to help change that on Nettuts+! In this session, you'll learn both why and how to test-drive your applications using the fantastic PHPUnit. Ready?

Posts in this series
  • News
    It's Time To Dig InIntroduction
    Let’s be honest: the PHP community hasn’t been as quick to the test-driven development pattern as other languages, like Ruby and Python. We hope to help change that on Nettuts+! In this session, you’ll learn both why and how to test-drive your applications using the fantastic PHPUnit.Read More…
  • PHP
    The Newbie's Guide to Test-Driven DevelopmentTdd
    Testing your code is annoying, but the impact of not doing so can be orders of magnitude more annoying! In this article, we'll use test-driven development to write and test our code more effectively.Read More…
  • PHP
    Test-Driven Development in PHP: First StepsTdd in php
    Let's admit it: the PHP community has lagged a bit, when it comes to advocating test-driven development. We know we should, but, even to this day, a sizable portion of the community does not. In this new series of videos and tutorials, created by the Nettuts+ team, we're hoping to change that. Trust me: it's not as tough as you think. Read More…
  • PHP
    Automatic Testing for TDD with PHPPreview
    Traditional test-driven development can, at times, be cumbersome. You have to stop writing code in order to run your tests. Luckily, there are solutions, which provide the ability to automatically run your tests as you code. In this tutorial, you will learn how to use a Ruby gem, called watchr, to monitor your code and automatically run the appropriate tests whenever you save your work.Read More…
  • PHP
    Let's TDD a Simple App in PHPTdd
    In this tutorial, I will present an end-to-end example of a simple application - made strictly with TDD in PHP. I will walk you through each step, one at a time, while explaining the decisions I made in order to get the task done. The example closely follows the rules of TDD: write tests, write code, refactor.Read More…
  • PHP
    Deciphering Testing JargonPreview
    Lately, we've been hearing and reading more and more about test-driven development. This domain, however, comes with a series of expressions and specific jargon that can be confusing to newcomers. This article will walk you through the most common definitions, test types and test parts. Use cases will be provided, and, where possible, some code in PHP will also be presented.Read More…
  • PHP
    All About Mocking with PHPUnitMocking in php
    There are two styles of testing: "black box" and "white box" styles. Black box testing focuses on the object's state; whereas, white box testing focuses on behavior. The two styles complement each other and can be combined to thoroughly test code. Mocking allows us to test behavior, and this tutorial combines the mocking concept with TDD to build an example class that uses several other components to achieve its goal.Read More…
  • PHP
    Hands-On Unit Testing With PHPUnitUnit testing
    In this screencast, we'll build a relatively simple class, using TDD techniques. Along the way, we'll discuss various PHPUnit methods, how to create mock objects, and more! I encourage you to work along; it's the best way to learn!Read More…
  • PHP
    How to Use Selenium 2 With PHPUnitPhpunit and selenium
    In this lesson, we will learn how to work with Selenium 2 directly within PHPUnit. For those unfamiliar, Selenium gives us an easy way to automate the browser. This makes it perfect for writing user acceptances tests.Read More…
  • Interviews
    Chatting With The Grumpy PHP ProgrammerGrumpy programmer interview
    I recently had the chance to catch up with Chris Hartjes, or, as some of you may know him, ""The Grumpy Programmer." Because he recently released a new ebook on test-driven development in PHP, I wanted to pick his brain a bit!Read More…
  • PHP
    Evolving Toward a Persistence LayerPersistence layer
    One of the most confusing design pattern is persistence. The need for an application to persist its internal state and data is so tremendous that there are likely tens - if not hundreds - of different technologies to address this single problem. Unfortunately, no technology is a magic bullet. Each application, and sometimes each component of the application, is unique in its own way - thus, requiring a unique solution.Read More…
  • PHP
    Mockery: A Better WayMockery
    Mockery is a PHP extension that offers a superior mocking experience, particularly when compared to PHPUnit. While PHPUnit's mocking framework is powerful, Mockery offers a more natural language with a Hamcrest-like set of matchers. In this article, I'll compare the two mocking frameworks and highlight the best features of Mockery.Read More…