Componette

Componette

nette-intellij

nette-intellij / intellij-nette-tester 2.1.0

Nette Tester integration into PhpStorm.

Nette Tester integration into PhpStorm

Version Downloads

This plugin integrates Nette Tester into PhpStorm IDE.

Installation and requirements

This plugin is written for PhpStorm 2016.3 and above and is compiled for Java 8. You can find it in the Jetbrains plugin repository. Install it from Preferences → Plugins → Browse repositories... and search for Tester.

Usage

Configuration

This plugin provides a new configuration type for Nette Tester:

Run configuration

  • Test scope is the directory containing the tests you wish to run.
  • Tester executable specifies path to the Tester runner (/path/to/your/project/vendor/bin/tester if you installed Tester via Composer).
  • Tester options allows you to specify options for Tester script (refer to the docs). This field serves for options you cannot specify otherwise (see below).
  • Setup script allows you to specify the setup script (--setup option). You can leave this field blank if you don't use any.
  • Interpreter and interpreter options allow you to modify the environment in which your tests run (-p option and -d options).
  • Path to php.ini specifies the configuration file to use (-c option). You can leave this field blank, in which case tests will run without any configuration loaded.

Usage on Windows

Composer seems to do some necessary, but unfortunate transformations on vendor binaries. Therefore you need to point the Tester executable option to the actual PHP file in /path/to/your/project/vendor/nette/tester/src/tester.php.

Interpreting results

If you now run this configuration, test results will start to show in the Test Runner window:

Test results

To the left, there is a list of tests. You can toggle showing passed and skipped tests. If you click the test, you will see the detailed output in the console window to the right.

Navigating between a class and its test

You can navigate between a class and its test, or create a test for a class easily, via Navigate → Test.

The navigation is based on convention (class name + Test suffix), the creation assumes your tests reside in the same namespace as the code; if you use a different scheme, you can configure source to test namespace mapping in the project settings under Languages & Frameworks → PHP → Nette Tester.

Preferences

If you create a test for a class, the dialog now follows your namespace mapping and automatically updates the target test namespace (and directory, following the Directories project settings).

Create a TestCase dialog

In the project settings, you can also configure the path to your test environment bootstrap file, which is then automatically required in the generated TestCase files.

Running a single test method

You can right-click a single test method to run or even debug it in isolation. This merely executes the file as a PHP script, with the method name as a single argument.

Running tests from a directory

You can right-click a directory to run the tests within it. For this to be truly a one-click action, you should configure the Tester executable in the Nette Tester default run configuration template.

Default run configuration

  • 2.1.0 2.1.0

    • Added run line markers to run TestCase or test methods
    • Added support for run configuration in Docker
    • Added support for Nette Tester 2.0
    • Fixed Compatibility with PHPStorm 2019.2 (#43)
    • Fixed bug java.lang.NullPointerException on phpstorm startup (#45)
  • 2.0.0-beta.3 2.0.0-beta.3

    • The Create Test dialog does not autoupdate the target namespace and directory if invoked from the directory context (#26)
    • Added some handy inspections that make sure all your tests are actually executed (#3, #32)
    • You can right-click a single test case file to run it (#23)
    • Added support for nette/tester@dev-master for the time being (#30)
    • Fixed: bootstrap relative path resolves correctly if the target directory does not exist (#25)
    • Fixed: comparison failure reporting was broken on Unix systems
  • 2.0.0-beta.2 2.0.0-beta.2

    I know I said this release branch would be feature-frozen, but... well... not just yet. I'm far too excited about bringing the new features to be able to postpone them. Semver doesn't play well with the plugin's distribution channel anyway. Here they come:

    • In the project settings, you can configure the path to your bootstrap file; it is then automatically required in the created test files (see #20 for instructions if it does not work right away)
    • You can now right-click a single test method to run or debug it in isolation (#9)
    • Fixed: OutputHandler now recognizes and correctly parses the diff command generated on Windows (#21)
    • Fixed: OutputHandler no longer reports unsuccessful builds as "terminated" (#22)
  • 2.0.0-beta.1 2.0.0-beta.1

    After tens of hours of work, here comes a total rework of the plugin. This beta.1 release marks the feature freeze, now I'd like to focus on fixing bugs and releasing a stable version soon.

    • Most importantly, the plugin no longer relies on a specific fork of nette/tester. As of 2.0.0, the plugin supports all 1.x versions of Nette Tester. Hooray!
    • You can navigate between the class and its test, or create a test case for a class easily. The navigation is based on convention (class name + Test suffix), the creation assumes your tests reside in the same namespace as the code; if you use a different scheme, you can configure source to test namespace mapping in the project settings under PHP > Nette Tester.
    • The plugin ships with a run configuration producer for directories, so you can right-click a directory and run the tests within it. For this to be truly one-click action, you should configure the Tester executable in the Nette Tester default run configuration template.
    • You can view the diff of comparison failures (Assert::same() and alike) right in the test results window.
    • Output stack traces are decorated with links to files, provided you set Tester\Dumper::$maxPathSegments to a high enough value in your test environment.

    To support a wide range of Tester versions, I had to drop a few features. However, they should, in some form or another, be back once nette/tester#345 is resolved.

    • The plugin no longer groups TestCase methods in the test results window.
    • The plugin no longer lets you navigate to the tests from the test results window, nor run or debug them directly.

    Please test this release and report any bugs in the issue tracker.

  • v1.0.0-alpha.4 v1.0.0-alpha.4

    Fixed compatibility with PhpStorm 2016.3 (thx @Komanc, #15)

  • v1.0.0-alpha.3 v1.0.0-alpha.3

    Fixed compatibility with PhpStorm 2016.3.

  • v1.0-alpha2 v1.0-alpha2

    Compatible with 2016.1

  • v1.0-alpha v1.0-alpha

    Initial alpha version with basic capabilities:

    • Tester run configuration type and editor.
    • Displays results in the Test Runner window.
bar-chart-fill

Statistics

download-cloud-fill
N/A
star-fill
30
bug-fill
14
flashlight-fill
2.4y
price-tag-2-line

Badges

Componette Componette felix@nette.org