PhpStorm 2018.2,PHPUnit 5.7.27。进程结束,退出代码为 255
PhpStorm 2018.2, PHPUnit 5.7.27. Process finished with exit code 255
使用 Laravel 5.3、PHP 5.6 并尝试测试包的 class。
这是我的测试class
class OrderQuoteStrategyTest extends TestCase {
public function testCanSendQuote() {
$order=$this->createOrder();
$orderSpec=new Orderspec();
$this->expectException( \Exception::class);
$this->expectExceptionMessage( 'Order must be waiting for Quote');
$orderQuoteStrategy= new OrderQuoteStrategy();
$orderQuoteStrategy->canSendQuote( $order, $orderSpec );
}
}
右击 'Run OrderQuoteStrategyTest (PHPUnit)' 后,出现以下错误。
Process finished with exit code 255
我不得不post这种问答方式来帮助处于我这种情况的其他人。
检查 php_error_log:
PHP Parse error: syntax error, unexpected ':', expecting ';' or '{' in \vendor\doctrine\instantiator\src\Doctrine\Instantiator\Instantiator.php on line 95
似乎作曲家已将 'doctrine/instantiator' 更新到最新版本,该版本仅与 PHP 7.
兼容
解决方案将此添加到 require-dev :
"doctrine/instantiator": "1.0.5"
和运行作曲家更新。
运行 上面的测试再次成功,没有错误。
使用 Laravel 5.3、PHP 5.6 并尝试测试包的 class。
这是我的测试class
class OrderQuoteStrategyTest extends TestCase {
public function testCanSendQuote() {
$order=$this->createOrder();
$orderSpec=new Orderspec();
$this->expectException( \Exception::class);
$this->expectExceptionMessage( 'Order must be waiting for Quote');
$orderQuoteStrategy= new OrderQuoteStrategy();
$orderQuoteStrategy->canSendQuote( $order, $orderSpec );
}
}
右击 'Run OrderQuoteStrategyTest (PHPUnit)' 后,出现以下错误。
Process finished with exit code 255
我不得不post这种问答方式来帮助处于我这种情况的其他人。
检查 php_error_log:
PHP Parse error: syntax error, unexpected ':', expecting ';' or '{' in \vendor\doctrine\instantiator\src\Doctrine\Instantiator\Instantiator.php on line 95
似乎作曲家已将 'doctrine/instantiator' 更新到最新版本,该版本仅与 PHP 7.
兼容解决方案将此添加到 require-dev :
"doctrine/instantiator": "1.0.5"
和运行作曲家更新。
运行 上面的测试再次成功,没有错误。