Ever since codebender started growing, one of the biggest challenges we faced was pushing updates to our compiler and being able to quickly iterate on it, fixing bugs and improving its performance. Since we’re kind of obsessed with making all of codebender’s users happy, we need to make sure that all changes applied to the compiler won’t break existing sketches. After all, what’s a web Arduino IDE if you can’t compile your code in it? As of today, about 70000 users have registered to codebender and it hosts more than 200000 projects. How can you make sure all of them work fine without having the whole testing process last forever?

Symfony is a powerful PHP framework. That is, a set of tools which you can use and create almost any web application and it’s way much faster than writing everything from scratch. codebender and most of its components, such as the cloud-based compiler, are built using Symfony. Symfony offers several mechanisms which can get you started, literally in, minutes. In the next sections we are going to demonstrate how you can create a simple book store application with Symfony without actually writing any code. Our application will consist of a database for storing data about the books on the store, as well as the web interface for adding and editing books on the database.

Introduction

“Hello world!” This phrase should be common to all developers since it’s the first thing you get to do when learning a programming language. However, no actual program -especially modern web apps- is as simple as your first “hello world” program. Code complexity can escalate very quickly and debugging can become really challenging. That’s exactly where testing comes into play. Tested code is the only way to make sure your application will work as expected under any circumstances. Unit testing is a software testing method by which individual units of source code (methods) are tested in order to make sure they fulfill our expectations. codebender is written using the Symfony2 framework and PHPUnit is one of the main tools we use to unit test our code. In this tutorial, we’ll go through some examples of how to write basic tests, and explain the main aspects of unit testing.