Advertisement
PHP

Test-Driven Development in PHP: First Steps

by

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.


Lesson 1 - Setup

In this series, we'll be using Composer, a dependency manager, to install PHPUnit (or at least, the unofficial version for now). To ensure that we've installed it properly, we'll also create a quick calculator test and class.

Choose 720p for the clearest picture.

Show Links

Related Posts
  • Code
    Web Development
    PHPStorm: When the IDE Really MattersPhpstorm preview
    The IDE that you choose to use day in and day out, can make a big difference in your web dev workflow. PHPStorm offers many wonderful features to improve this process, let's take a look!Read More…
  • Code
    Web Development
    Test Code Coverage: From Myth to RealityXdebug wide retina preview
    Learn the myths about test code coverage and how to use it to analyze how much of your production code has been tested.Read More…
  • Code
    PHP
    Setting Up a Local Mirror for Composer Packages With SatisComposer retina preview
    Installing all your PHP libraries with Composer is a great way to save time. But larger projects automatically tested and run at each commit to your software version control (SVC) system will take a long time to install all the required packages from the Internet. You want to run your tests as soon as possible through your continuous integration (CI) system so that you have fast feedback and quick reactions on failure. In this tutorial we will set up a local mirror to proxy all your packages required in your project's composer.json file. This will make our CI work much faster, install the packages over the local network or even hosted on the same machine, and make sure we have the specific versions of the packages always available.Read More…
  • Code
    PHP
    Acceptance Testing With CodeceptionIntro to codeception retina preview
    Typically new features for web applications are tested by visiting the appropriate page in a browser, maybe filling out some form data, submitting the form, and then developers or testers hope to see their desired result. This is the natural way most web developers test their apps. We can continue with this natural testing process and improve upon it to ensure our apps are as stable as possible by using Codeception. Read More…
  • Code
    PHP
    Parallel Testing for PHPUnit with ParaTestPhpunit 400
    PHPUnit has hinted at parallelism since 2007, but, in the meantime, our tests continue to run slowly. Time is money, right? ParaTest is a tool that sits on top of PHPUnit and allows you to run tests in parallel without the use of extensions. This is an ideal candidate for functional (i.e Selenium) tests and other long-running processes.Read More…
  • Code
    PHP
    Better Workflow in PHP With Composer, Namespacing, and PHPUnitPhpunit composer autoloading namespacing
    In this video tutorial, we'll again focus on workflow. Specifically, we'll use Composer's built-in autoloading capabilities, along with namespacing, to make for an elegant testing experience. We'll also review a handful of PHPUnit best practices, as we get setup with these tools.Read More…