Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
我们不允许在PHPUnit文件中创建私有方法吗?_Php_Unit Testing_Web - Fatal编程技术网

我们不允许在PHPUnit文件中创建私有方法吗?

我们不允许在PHPUnit文件中创建私有方法吗?,php,unit-testing,web,Php,Unit Testing,Web,我已经编写了一个phpUnit文件和一个运行良好的测试。我注意到,在我的下一个测试中,测试的很大一部分将是可重用的,所以我决定提取一个私有方法。当我再次运行它时,我得到: "Test method "<method name>" in test class "<Test Class Name>" is not public. “测试类”中的“测试方法”不是公共的。 我们真的不允许编写私有方法吗?好的,似乎所有以“test”开头的方法都被视为单独的测试。我最终重命名了我

我已经编写了一个phpUnit文件和一个运行良好的测试。我注意到,在我的下一个测试中,测试的很大一部分将是可重用的,所以我决定提取一个私有方法。当我再次运行它时,我得到:

"Test method "<method name>" in test class "<Test Class Name>" is not public.
“测试类”中的“测试方法”不是公共的。

我们真的不允许编写私有方法吗?

好的,似乎所有以“test”开头的方法都被视为单独的测试。我最终重命名了我的私有方法