@dependens标志中断PHPUnit函数中的参数

@dependens标志中断PHPUnit函数中的参数,phpunit,Phpunit,在下面的代码中,testFunctionA输出true,而testFunctionB输出null。这是一个已知错误吗?我可以在不清除@depends标志的情况下绕过它吗 public function testFunctionA( $x = true ) { var_dump( $x ); // outputs true } /* * @depends testFunctionA */ public function testFunctionB( $y = true ) { var_d

在下面的代码中,testFunctionA输出true,而testFunctionB输出null。这是一个已知错误吗?我可以在不清除@depends标志的情况下绕过它吗

public function testFunctionA( $x = true ) {
  var_dump( $x ); // outputs true
}

/*
* @depends testFunctionA
*/
public function testFunctionB( $y = true ) {
  var_dump( $y ); // outputs NULL
}

@depends注释比您在这里想象的要多一些。主要是将TestFunction的返回值传递到testFunctionB。因为testFunctionA不返回任何内容,所以testFunctionB被传递了一个空值

有关更多信息,请参阅PHPUnit文档


向testFunctionB提供null参数和不提供任何参数之间存在差异。只有在不提供任何内容的情况下,$y才会默认为true。

@depends注释的作用比您在这里想象的要多。主要是将TestFunction的返回值传递到testFunctionB。因为testFunctionA不返回任何内容,所以testFunctionB被传递了一个空值

有关更多信息,请参阅PHPUnit文档

向testFunctionB提供null参数和不提供任何参数之间存在差异。只有不提供任何内容时,$y才会默认为true