Sublime Forum

PHPUnit support for Sublime Text

#1

PHPUnitKit is a plugin that provides PHPUnit support. It provides an abstraction over running tests from the command-line.

GitHub: PHPUnitKit
Package Control: PHPUnitKit

  • Zero configuration required; Does the Right Thing
  • Test Suite, Test File, Test Nearest, Test Last, and other commands
  • Supports Composer
  • Supports colour test results (including failure diffs)
  • Jump to next/previous test failure via keybinding F4/Shift+F4
  • Switch File (splits window and puts test case and class under test side by side)
  • Fully customized CLI options configuration

Command Palette

  • Test Suite | Runs the whole test suite.
  • Test File | Runs all the tests in the current file test case.
  • Test Nearest | Runs the test nearest to the cursor. Use multiple selection to run more than one test.
  • Test Last | Runs the last test.

2 Likes

#2

2.0.0 - 2017-03-24

Added

  • Added #56: Support for .php-version file to specify PHP version to use for running PHPUnit
  • Added #55: Use different PHP executable
  • Added #53: Vi keymaps are now enabled by default
  • Added #52: Test File command

Changed

  • Changed #42: Commands:

    Old name -> new name
    Run All Tests -> Test Suite
    Run Last Test -> Test Last
    Run Single -> Test Nearest
    Switch Test Case / Class Under Test -> Switch File
    Open HTML Code Coverage in Browser -> open Code Coverage
    Cancel Test Run -> Cancel Test
    Show Test Results -> Show Results

  • Changed #54: Vim Keymaps:

    Old keymap -> New keymap -> Description
    ,t -> ,a -> Test All
    ,r -> ,t -> Test Single
    ,e -> ,l -> Test Last

  • Changed: Settings:

    Old setting -> new setting
    phpunit.keymaps.vi -> phpunit.vi_keymaps

Fixed

  • Fixed #57: Find next / previous failure keymaps (Windows)
0 Likes

#3

2.0.1 - 2017-03-29

Fixed

  • Fixed #58: Error when ~/.phpenv/versions path doesn’t exist
0 Likes

#4

2.0.2 - 2017-04-13

Fixed

  • Fixed #59: Error when trying to run PHPUnit with a PHP executable (Windows)
  • Fixed: Error when trying to run a global install of PHPUnit with a PHP executable
  • Fixed: Errors when some paths contained characters like spaces
  • Fixed: Environment variables now work in path settings like “phpunit.php_executable” and “phpunit.php_versions_path”
  • Fixed: Project PHP version file (.php-version) version number not working for some version numbers
  • Fixed: Jump to next/previous error didn’t work in some cases where file paths contained characters like spaces
  • Fixed: Running tests now terminates any currently running tests before running tests
  • Fixed: .php-version file version is no longer overridden by the default executable ‘phpunit.php_executable’
0 Likes

#5

2.0.3 - 2017-04-19

Fixed

  • Fixed #63: Switches to wrong test
0 Likes

#6

2.1.0 - 2017-05-17

Added

  • Added: New syntax definition format for test results panel
  • Added: Test File command will now also run the test case for current file

Deprecated

  • Deprecated: Colour schemes are deprecated and will be removed in v3.0.0

Fixed

  • Fixed: .travis.yml is not needed in release package
  • Fixed: All status messages should be prefixed with "PHPUnit: "
  • Fixed: No status messages in some edge cases
0 Likes

#7

2.2.0 - 2017-06-13

Added

  • Added #38: Command “PHPUnit: Test Visit” (phpunit_test_visit) Open the last run test in the current window (useful when you’re trying to make a test pass, and you dive deep into application code and close your test buffer to make more space, and once you’ve made it pass you want to go back to the test file to write more tests)
  • Added: Command “phpunit_test_cancel” for cancelling tests
  • Added: Command “phpunit_test_results” for opening the test results panel

Changed

  • Renamed: Command “PHPUnit: Cancel Test” to “PHPUnit: Test Cancel”
  • Renamed: Command “PHPUnit: Show Results” to “PHPUnit: Test Results”
  • Renamed: Command “PHPUnit: Open Code Coverage” to “PHPUnit: Test Coverage”
  • Renamed: Command “PHPUnit: Switch File” to “PHPUnit: Test Switch”

Deprecated

  • The command “phpunit_open_code_coverage” is deprecated and will be removed in v3.0.0; use “phpunit_test_coverage” instead
  • The command “phpunit_switch_file” is deprecated and will be removed in v3.0.0; use “phpunit_test_switch” instead
0 Likes

#8

2.2.1 - 2017-06-13

Fixed

  • Fixed: TypeError: object of type ‘NoneType’ has no len()
0 Likes

#9

2.2.2 - 2017-08-11

  • Fixed #66: PHPUnit: ‘NoneType’ object has no attribute ‘items’
0 Likes

#10

2.3.0 - 2017-08-23

Added

  • Added: Improved color scheme support for test results
  • Added: :TestSwitch now positions cursor at the row of the class definition

Removed

  • The default key bindings have been removed, instead add your preferred key bindings:

    Menu > Preferences > Key Bindings

    [
        { "keys": ["ctrl+shift+a"], "command": "phpunit_test_suite" },
        { "keys": ["ctrl+shift+f"], "command": "phpunit_test_file" },
        { "keys": ["ctrl+shift+n"], "command": "phpunit_test_nearest" },
        { "keys": ["ctrl+shift+l"], "command": "phpunit_test_last" },
        { "keys": ["ctrl+shift+v"], "command": "phpunit_test_visit" },
        { "keys": ["ctrl+shift+s"], "command": "phpunit_test_switch" },
        { "keys": ["ctrl+shift+c"], "command": "phpunit_test_cancel" },
        { "keys": ["ctrl+shift+r"], "command": "phpunit_test_results" },
    ]
    

    The following key bindings remain the same:

    Key Description
    F4 Jump to Next Failure
    Shift+F4 Jump to Previous Failure

0 Likes

#11

Best PHPUnit plugin by far :kissing_heart:

Is it possible to change the green and red on success and failure? they’re a bit bright for my liking and i’d like them to match my theme.

1 Like

#12

I just pushed a few fixes and improvements for color schemes:

The default colors are now the same as MonokaiFree.

You can add support plugin by overriding three scopes, see:

1 Like

#13

Works perfectly thank you :smiley:

1 Like

#14

2.4.0 - 2017-08-23

  • Added #69: Can I adjust the font size of the test result panel

2.4.1 - 2017-08-23

  • Fixed: #70: Tests results don’t have colors anymore

2.4.2 - 2017-11-19

  • Fixed: Support for new Sublime Text color scheme format

2.4.3 - 2017-11-20

  • Fixed: #75: Test results colors don’t work

2.4.4 - 2017-11-23

2.4.5 - 2017-12-05

  • Fixed: #76: Testing nearest doesn’t always work

2.4.6 - 2017-12-08

  • Fixed: #76: Testing nearest doesn’t always work
0 Likes

#15

2.5.0 - 2018-03-03

Added

  • Added: #78: Add support for PHPUnit Pretty Result Printer
0 Likes

#16

3.0.0 - 2018-03-06

Changed

  • Changed: Renamed plugin from “phpunitkit” to “PHPUnitKit”

    If you manually installed the package then you will need to rename the folder where you installed it from “phpunitkit” to “PHPUnitKit”, otherwise updating from Package Control requires nothing for you to do.

    https://github.com/wbond/package_control_channel/pull/6983

Removed

  • Removed: Deprecated color schemes (color schemes are auto generated based on the active color scheme)
  • Removed: Deprecated command phpunit_switch_file, use phpunit_test_switch instead
  • Removed: Deprecated command phpunit_open_code_coverage, use phpunit_test_coverage instead
1 Like