Integrates the phpunit testing system into the atom text editor.
This is in beta mode at the moment. I would appreciate any testers and feedback.
- Point and click interface
- Code Coverage highlighting
- Test Suite/Case generation
phpunit.xml
andphpunit.xml.dist
aware- Runs test suites/groups/cases
- Quick navigation links to errors
- Progressive test output
- Vertical / Horizontal layout
- Tree View integration
cmd-alt-u
|ctrl-alt-u
: Toggles the test viewcmd-alt-t
|ctrl-alt-t
: Runs the currently selected test suitecmd-alt-f
|ctrl-alt-f
: Runs the open filecmd-alt-c
|ctrl-alt-c
: Runs the test class under the cursorcmd-alt-y
|ctrl-alt-y
: Runs all test suites in thephpunit.xml
filecmd-alt-g
|ctrl-alt-g
: Runs all files in the test directorycmd-alt-v
|ctrl-alt-v
: Runs the test method under the cursorcmd-alt-k
|ctrl-alt-k
: Goto the test class under the cursorcmd-alt-m
|ctrl-alt-m
: Goto the test method under the cursor
In addition to keyboard shortcuts, it is also possible to run tests and navigate to test files by right-clicking within a class or method body and selecting the appropriate entry in the context menu.
All testable projects are required to have either a phpunit.xml
or phpunit.xml.dist
file in the project root.
The default installation presumes you have 'src' and 'tests' directories in the root of your project. It also presumes you use the 'Test' namespace segment for all classes within the 'tests' directory.
For example, a source class located at:
/var/www/project/src/Entity/User.php
under the namespace \Vendor\Project\Entity
will be mapped to a test class located at:
/var/www/project/tests/Entity/UserTest.php
under the namespace \Vendor\Project\Test\Entity
This default behaviour can be modified by placing a phpunit.js
(or phpunit.coffee
)
file in any directory between the source file and the project root. This file can
contain any valid nodejs
code, but it must export a single object which contains
the redefined methods of PhpUnitDefaultAdapter.
So, for example, to change the default test directory from tests
to spec
include
the following in the file:
module.exports = {
getTargetDirectory() {
return 'spec';
}
}
All methods declared in this file will replace the original methods in a new instance.
So, it is safe to call other methods using this
or even store properties in the
instance.
The first adapter found, searching from the source towards the root, will be used. This allows for a per-directory configuration.
When the XDebug module is loaded via your php.ini
configuration, a 'Code Coverage'
toggle button will become available in the packages main view. For those of you whom
don't want XDebug enabled system wide, The full path to the XDebug extension can
be configured within the package settings. This will display the 'Code Coverage'
toggle and only load the extension when the toggle is enabled.
After switching to atom, I missed the phpunit integration within the netbeans editor. This is an attempt at creating a similar environment.
Copyright (c) 2018 Owen Parry [email protected]