The Author

Miguel Muscat

A passionate freelance developer with a particular love for PHP web development. Currently I'm a developer for WP RSS Aggregator and the lead developer for the EDD Bookings extension. My other interests are music production, gaming, anime and robotics.

Articles written by Miguel Muscat

Unit Testing with PHPUnit

The term, quite simply, refers to the process of dividing software into the smallest testable components, called units, that can be tested independently to assert whether they fulfill their requirements and operate as intended.

There are many benefits that come with unit testing. One of the most important is that it allows you (and perhaps even your stakeholders) to determine the completeness of your software. By simply running your tests cases, you can easily confirm that the code works as expected.

WordPress Heartbeat vs AJAX Polling

WordPress 3.6 introduced the “Heartbeat API”. This API is used internally by WordPress to keep track of logged in users and their active sessions. If you’ve ever been asked to log into WordPress while navigating the admin panel, then you’ve already experienced the API at work.

The API uses Javascript polling, to constantly send data from our dashboard to WordPress’ PHP backend. Developers are also allowed to hook in, adding and modifying the data sent through various filters.

But when should you use the Heartbeat API in contrast to regular AJAX polling? To make an informed decision, we’ll need to look at both approaches, understand how they work and how to use them, and the advantages and disadvantages for both.