A simple Sublime Text 2 plugin for atoum

Atoum is a great unit testing framework for php made by mageekguy and Sublime Text 2 a must have text editor. I was looking for a plugin which can execute tests without leaving the editor like the existing vim-plugin. I couldn’t find one.

I decided so to make one and learn how to make a plugin in Sublime Text 2. It was less complicated than I though even if it should be written in python, it’s a good way to lean it :) I started to look at the Sublime Text 2 Documentation, its API Reference, how to submit a package and the python standard library.

This atoum plugin has so far the features below:


  1. Test a single php file (via the context menu and the command palette).
  2. Test all php files in a directory (via the sidebar, via the context menu and the command palette).
  3. Result will show up in a other tab in read-only.
  4. Result should be parsed with colors.
  5. Possibility to install the plugin via the Package Control.
  6. Light report in a panel
  7. Shortcut: cmd+alt+s on OSX or ctrl+alt+a on Linux and Windows: Test the current file
  8. Shortcut: cmd+alt+d on OSX or ctrl+alt+d on Linux and Windows: Test files in the current directory


Once installed, browse the package and change atoum.sublime-settings with your parameters. But it’s better to add your own config file, just open the command panel, write Atoum: User File Settings and paste the configuration below with your parameters. Remember to restart Sublime Text 2.

If you activate the light report, the test result will be shown in a panel not in a tab. This is very usefull when used with the shorcut to test quickly. It’s close to the loop mode.

    “php_command”: “/opt/local/bin/php”,
    “atoum_phar_file”: “/usr/local/bin/mageekguy.atoum.phar”,
    “use_light_report”: true


Result in a tab: 'A simple Sublime Text 2 plugin for atoum, unit testing framework for php' Result in a panel: 'A simple Sublime Text 2 plugin for atoum, unit testing framework for php'


  • atoum.py in general (especially errors handler).
  • Add light report mode
  • Better result color parsing (it’s just the standard diff parser at the moment).
  • Works on Mac OS X, not tested on Linux and Windows yet.
  • Possibility to bind shortcuts.
  • Reload user’s configuration file without restart Sublime Text 2
  • Handle errors if it’s not a php file and if there is no php file in the diretory
  • A new way to parse colors in light report
  • Sublime Text 2 report in atoum

This plugin is will be soon available via the Package Control. I sent the pull request.

You can install it manualy by cloning the repository in ~/Library/Application Support/Sublime Text 2/Packages.

Well, this plugin is far to be finished. So don’t hesitate to fork it and send me your pull requests :)

Antoine Corcy

Developer / Copenhagen

Copenhagen, Denmark http://sbin.dk