Tag Archives: unit testing

PHPUnit on Server changes in PhpStorm 7

Unit testing follows the mantra that “the same input always should generate the same output.” But what if some developers on a team have different PHP configurations, or maybe one uses Windows and the other one Mac OS X? Does … Continue reading

Posted in Cool Feature | Tagged , , , | 7 Comments

Installing and Configuring XAMPP / MAMP with PhpStorm

Developing for PHP can be done in several ways. Some like to install all components they want to work with themselves. Others prefer downloading and installing a full “LAMP” stack at once. The latter can be done using XAMPP (Windows, … Continue reading

Posted in Cool Feature | Tagged , , , , , | 4 Comments

Working with Phar packages in PhpStorm

PHP comes with the Phar extension bundled, which allows us to put entire libraries or applications into a single “phar” file. This makes it easier to distribute our code: it’s just one file! PhpStorm can work with Phar packages in … Continue reading

Posted in Cool Feature | Tagged , , , | 7 Comments

Loading PHPUnit from PHAR archive in PhpStorm 6

Since version 3.7 it is possible to load PHPUnit with all the required (as well as some optional) dependencies from a single PHAR file (see the official documentation for details). If you are stuck with PEAR dependency versions, it might … Continue reading

Posted in Cool Feature | Tagged , , , | 3 Comments

Creating PHPUnit Tests in PhpStorm

Starting with PhpStorm 6.0, PHPUnit Skeleton Generator is no longer available in the IDE. PHPUnit tests creation functionality has been completely re-worked so that PhpStorm generates tests itself and you can benefit from its flexibility and code insight. The IDE … Continue reading

Posted in Cool Feature | Tagged , | 4 Comments

PHPUnit installation via Composer in PhpStorm

Since version 3.7, PHPUnit allows us to install the test runner and optional dependencies using Composer. With PhpStorm 6, this workflow is now supported from the IDE. Using both the bundled Composer support and PhpStorm’s unit testing support, we can … Continue reading

Posted in Cool Feature, PhpStorm | Tagged , , , , | 7 Comments

Running CakePHP2 Unit Tests in PhpStorm

CakePHP2 comes with unit testing support powered by PHPUnit. In addition to the features offered by PHPUnit, CakePHP offers some additional features to make testing easier. Unit tests in CakePHP rely on a custom test runner which can be run … Continue reading

Posted in Cool Feature, PhpStorm | Tagged , , , , | 7 Comments

Continuous Integration for PHP using TeamCity

If you have multiple team members, you should be doing Continuous Integration (CI). By building the desired output artifacts on a frequent basis and analyzing their quality using unit tests and code coverage, you will find that there are fewer … Continue reading

Posted in Cool Feature, Tutorial | Tagged , , , , , , | 2 Comments

PhpStorm Type Inference and Mocking Frameworks

Recently, we received a question on Twitter asking about how PhpStorm handles type inference when working with mocking frameworks. Imagine having the following two classes: When writing a unit test for ClassA, it’s very easy to mock ClassB using PHPUnit’s … Continue reading

Posted in Cool Feature, PhpStorm, Tutorial | Tagged , , , , | 7 Comments