- Description
- Features
- Dependencies
- How to use
- Extension Settings
- Known Issues
- Release Notes
- Contributing
- License
- Feedback
- Acknowledgements
The transformcommentedtestlinestophpunit
is a Visual Studio Code extension tailored for PHP developers who use PHPUnit for testing. This extension enables a streamlined process of creating PHPUnit test methods from comments, thus making your coding and testing process faster and more efficient.
The extension operates by scanning your active PHP file for any line comments starting with //test
or // test
. It then transforms these comments into boilerplate PHPUnit methods, laying the groundwork for your test cases. The extension is designed to only work on PHP files that end with Test.php
, ensuring it only functions in the context of your test files.
Remember to replace the method body with your test implementation to make the test meaningful.
- Transforms
//test
or// test
comments into PHPUnit methods quickly and efficiently. - Exclusive functionality for PHP files ending with
Test.php
.
The transformcommentedtestlinestophpunit
extension depends on the following packages:
@types/vscode
version^1.70.0
@types/glob
version^8.1.0
@types/mocha
version^10.0.1
@types/node
version16.x
eslint
version^8.39.0
glob
version^8.1.0
mocha
version^10.2.0
typescript
version^5.0.4
@vscode/test-electron
version^2.3.0
- Open a PHP file in Visual Studio Code that ends with
Test.php
. - Add a comment line starting with
//test
or// test
and write the name of your test function. For example://test should return true
- Press
F1
to open the Command Palette. - Start typing
Transform commented lines to PHPUnit methods
and select it. - The extension will replace the
//test
comment with a PHPUnit method.
Input
<?php
use PHPUnit\Framework\TestCase;
final class UserTest extends TestCase{
//test get name returns an empty string by default
//test set name returns true
//test get name returns the expected value
//test getname returns a string
}
Output
<?php
use PHPUnit\Framework\TestCase;
final class UserTest extends TestCase{
public function testGetNameReturnsAnEmptyStringByDefault(){
}
public function testSetNameReturnsTrue(){
}
public function testGetNameReturnsTheExpectedValue(){
}
public function testGetnameReturnsAString(){
}
}
This extension currently does not offer any configurable settings.
No known issues at this time.
Initial release of transformcommentedtestlinestophpunit
If you have suggestions for improving transformcommentedtestlinestophpunit, or want to report a bug, open an issue! Contributions of all kinds are welcome.
This project is licensed under the MIT License. See the LICENSE file for details.
If you have any feedback, please reach out on GitHub.
This project follows the all-contributors specification. Contributions of any kind are welcome!