vscode php5 语法支持,VSCode打造PHP5环境

I'm struggling with setting up environment for old tech project with PHP5. My OS is Windows and I have installed so far VSCode plugins: PHP Debug, PHP Intelephense, PHPUnit, PHPUnit Test Explorer. I downloaded phpunit-5.7.27.phar and configured VSCode according to documentation.

Settings.json

{

"php.validate.executablePath": "C:/wamp64/bin/php/php5.6.40/php.exe",

"phpunit.phpunit": "C:/wamp64/bin/php/php5.6.40/phpunit-5.7.27.phar",

"phpunit.php": "C:/wamp64/bin/php/php5.6.40/php.exe",

"intelephense.environment.phpVersion": "5.6.40",

"intelephense.environment.includePaths": [

"C:/wamp64/bin/php/php5.6.40/phpunit-5.7.27.phar",

"C:/wamp64/bin/php/php5.6.40/php.exe",

"C:/wamp64/bin/php/php5.6.40/"

]

}

Launch.json

{

"version": "0.2.0",

"configurations": [

{

"name": "Listen for XDebug",

"type": "php",

"request": "launch",

"port": 9000,

"xdebugSettings": {

"max_children": 256,

"max_data": 500,

"max_depth": 3

}

},

]

}

What works for me fine is breakpointing on running app with xdebug and running unittests with Cmd+Shift+P.

What I need help with are as follows:

Code editor shows error for PHP unit classes and methods (even though unittests are executing fine as is). Do I need to add to path something besides phar file? Is VSCode non-compatible with phar files? The same happens for PHPUnit\Framework\TestCase.

I can't figure out how to configure Test Explorer plugin to show nicely tests tree. Does it require some configuration in Launch.json? Launching tests with Cmd+Shift+P displays results only in terminal.

Jx34H.jpg

# Answer 1

4d350fd91e33782268f371d7edaa8a76.png

PHP Intelephense requires installed PHPUnit with composer in workspace.

composer require --dev phpunit/phpunit

PHPUnit Test Explorer has by default Phpunit: Files setting set to {test,tests}/**/*Test.php, so changing it to proper glob should allow plugin to detect all tests.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值