
PHPUNIT MOCKS INSTALL
It introduces you to Composer in general and how it utilizes PSR-0 for autoloading.Īll it takes to install PHPUnit is a single line in your composer.json file:
PHPUNIT MOCKS HOW TO
If you do not know what Composer is or how to use it then you should read my previous article, Composer Namespaces in 5 Minutes. Now that Composer has come and taken the crown of package manager I suggest you go with it.

It used to be that the recommended way of installing PHPUnit was through PEAR. If you are used to a GUI doing everything for you, it is high time you cowboy up and got to loving the terminal. We are also going to use the command line to run … commands. If you do not have a proper environment set up then I recommend you read through my Setting Up a Debian VM, Step by Step guide to get you up and running painlessly. I highly recommend using a VM that mimics a server environment instead of having your server running alongside your daily OS. This series will assume you have a proper development environment set up. He is now holding classes to teach you some knowledge and I wholeheartedly recommend you take a good look.

Chris has been screaming at the PHP community for years that they should test. If you would like to be serenaded with the virtues of testing then I recommend you check out the book Real-World Solutions for Developing High-Quality PHP Frameworks and Applications by Sebastian Bergmann and check out my buddy Chris Hartjes, The Grumpy Programmer’s blog. What this series will not go over is why you should test, why testing is good and the benefits of testing, other than a slight glossing over. I will lightly touch on test-driven development but will not focus on it as I believe writing your code to be testable and learning how to actually test is a big enough challenge to learn at first without throwing in a completely different method to your development process. It will tell you why statics are bad, why dependency injection is king, what the difference between a mock and a stub is and how to love the red and green bar. This series will introduce you to the core concepts of testing.

