PHP in Action

Running PHP tests inside Vim

dagfinn | 14 July, 2007 14:15

I created my own test runner to run tests inside Vim, I can't remember how long ago. Must be a year or two. I never shared it with the world. It was too primitive for anyone else to use. Then, recently, I decided to try re-implementing it in a more serious way. That meant using a more sophisticated programming language. Vim script has seen some improvements and is pretty useful for simple tasks, but I want something that's object-oriented and has a test framework. That means Perl, Python or Ruby, all of which are available from inside Vim. So I've started doing it in Ruby.

It's not ready for public consumption yet, but I think it will be eventually. Here's what it looks like at the moment:

This is how I program about 90 per cent of the time: the test case and the class I'm testing side by side and a small extra window to show the test results. I can run the test by pressing F11 (which just happened to be the key that was available at the time). I work test-first, so before implementing something on the left, I have to write another test on the right. It's less tempting to start implementing without tests when there's an easy way to run the tests.

Comments

Great

Carl | 14/07/2007, 15:16

Wow, this is great! I can't wait to get my hands on this implentation :-) Carl

Thanks

dagfinn | 15/07/2007, 11:53

Thanks, I'll try even harder to find the time to get it ready for prime time.

Re: Running PHP tests inside Vim

mod rewrite | 19/07/2007, 01:40

I use only Eclipse.. vim is to complicated.

Fantastic

GameOn | 19/07/2007, 01:49

This looks awesome, just don't rush it, make it how you want it!

Eclipse vs. Vim

dagfinn | 19/07/2007, 07:59

If Vim is too complicated, there is an "easy mode" that makes for more "normal" editing.

For example:

http://www.linux.com/articles/60991

eclipse

mod rewrite | 01/08/2007, 05:44

Eclipse is better.. I use linux but vim for projects? Never.

PHPUnit

Sebastian Bergmann | 25/10/2007, 22:25

I would still like to see PHPUnit support in that vim plugin of yours :)

PHPUnit

dagfinn | 29/10/2007, 06:19

There is support for PHPUnit. I just haven't released the plugin yet. The only really difficult task I have left is getting it to work with Vim sessions. Running PHPUnit is simple by comparison.

Can't wait

Bjarte S. Karlsen | 01/11/2007, 16:14

I can't wait for this to be released Dagfinn :) I use vim and phpunit alot each and every day.

this would be great to have

Kris Day | 16/11/2007, 22:44

Hi, I am leaning vim and it is a blast. This would be a great addition. PS - I read your book and it was excellent. I'm an English major coming from the land of marketing and studying PHP to start a second career. Nice use of metaphor, well constructed, well edited. Good job. Really!
 
Accessible and Valid XHTML 1.0 Strict and CSS
Powered by LifeType - Design by BalearWeb