How to run WordPress tests in VVV using PHPStorm 8

EDIT: You might also be interested in:
How to run WordPress tests in VVV using WP-CLI and PHPStorm 8.


I’ve been busy all day trying to make this work, and at last I got it.

(1) Start the virtual server: ´$ vagrant up´.

(2) Access PHPStorm preferences, look for PHP and select the leftmost PHP tab.

(3) On the right pane, at the right of the Interpreter select box, click on […].

(4) At the top of the Interpreters pop up, click on [+], and select [Remote…].

(5) On the Configure Remote PHP Interpreter pop up, select Vagrant.

(6) After connecting, click on [OK].

(7) When it stops doing stuff, rename the interpreter. Then click on [OK].

(8) On the PHP pane again, above the the Interpreter select box, select the PHP language level, then click on [Apply] and on [OK].

(9) Add a Remote Interpreter for PHPUnit, pointing to the VVV server like this:

Screen Shot 2014-10-26 at 22.18.06

(10) Create a Run/Debug configuration for PHPUnit like this:

Screen Shot 2014-10-26 at 21.49.06

Probably you will also need to restart PHPStorm.

I really wanted to get through it to be able to debug tests later, but to just run them all it’s not very convenient. It takes double the time. 15 minutes from the command line, 30 minutes from PHPStorm!!

Screen Shot 2014-10-26 at 22.25.34

Class RegularExpression for PHP

UPDATE

This is a small class for handling Regular Expressions in PHP. I often have to use backreferences and it’s very cumbersome to compose simple expressions with them into more complex ones, because I have to manually count all capturing groups many times in a row. This class basically solves that issue for me.

{[ .class | 1.hilite(=php=) ]}