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.
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 PHPT sections completion](https://resources.jetbrains.com/help/img/idea/2022.1/ps_phpt_test_section_completion.png)
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 injection in PHPT sections](https://resources.jetbrains.com/help/img/idea/2022.1/ps_phpt_test_section_code_injection.png)
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 Navigate to file from a PHPT section](https://resources.jetbrains.com/help/img/idea/2022.1/ps_phpt_test_section_navigate_to_file.png)