PhpStorm 2020.3 Help

PHPT Support

If you are working on a custom PHP extension or want to contribute to the PHP core, you can test your code by using .phpt tests. These tests are written in PHP and comprise a set of PHP scripts and additional information divided into sections.

At the bare minimum, a PHPT test must contain the TEST, FILE, and EXPECT sections.

--TEST-- A basic test --FILE-- <?php $string = "Hello World!"; var_dump($string); ?> --EXPECT-- string(12) "Hello World!"

Completion for PHPT section names

PhpStorm will highlight the PHPT sections in a .phpt file, and provide you with auto-completion Ctrl+Space for their names:

PHPT sections completion

Code injection in PHPT sections

PhpStorm will automatically inject the PHP language inside the FILE, SKIPIF, FILEEOF, CLEAN sections, and the INI language — inside the INI and ENV sections:

Code injection in PHPT sections

Code navigation in PHPT sections

In _EXTERNAL sections, such as FILE_EXTERNAL or EXPECT_EXTERNAL, you can navigate to the referenced file. Position the caret at the reference and press Ctrl+B. Alternatively, Ctrl+Click the referenced file to open it in the editor.

Navigate to file from a PHPT section
Last modified: 08 March 2021