jjzjj

可以使用 Netbeans + PHPUnit 在远程服务器上进行 PHP 单元测试吗?

我已经在本地Windows机器和远程Linux服务器上安装了PHPUnit。我能够从Netbeans在本地运行PHPUnit。我的下一步是使用Netbeans触发PHPUnit.bat脚本来:-SSH到远程服务器-从那里运行PHPUnit我可以手动使用PLink到SSH并从远程服务器的PHPUnit运行中取回输出。关于如何配置PHPUnit.bat脚本来执行此操作的任何想法? 最佳答案 如果这有帮助:用于从netbeans7.4远程运行phpunit的Windows脚本:phpunit.bat@echooff::==========

windows - 如何从命令行使用 PHPUnit 运行 XDebug?

我让netbeans在Debug模式下运行。现在我想用?XDEBUG_SESSION_START=netbeans-xdebug运行单元测试,目标是在我进行时设置断点。可能吗?我试过这样的:phpunitmyTest.php?XDEBUG_SESSION_START=netbeans-xdebug不起作用。有什么想法吗?更新根据这个:http://blog.doh.ms/2011/05/13/debugging-phpunit-tests-in-netbeans-with-xdebug/Gotocommandlineandrunphpunit-debug.Nowdebuggingsta

php - php单元的测试方法

这个问题在这里已经有了答案:MockprivatemethodwithPHPUnit(11个答案)关闭6年前。我是TDD的新手。我有一个简单的类方法privatefunctiongetSelfSubmissionMsg($type){switch($type){case'efl':return'Somemessage.';case'split':return'Someothermessage.';}}如何使用phpunit测试此方法

php - ZF3 单元测试认证onBootstrap

我在为我的IndexController类运行单元测试时遇到问题。单元测试仅执行以下操作(灵感来自unit-testtutorialofzf3):IndexControllerTest.php:publicfunctiontestIndexActionCanBeAccessed(){$this->dispatch('/','GET');$this->assertResponseStatusCode(200);$this->assertModuleName('main');$this->assertControllerName(IndexController::class);//assp

PHPUnit - 我可以为较低版本的 PHP 运行测试吗?

如解释here我可以测试PHP版本是否至少为5.3.0。但是如果我想为低于5.3.0的PHP版本运行测试呢?我这样写:./tests/unit/test-file.php但是我收到这个错误Unescaped'我该怎么做? 最佳答案 根据version_compare的文档功能:Thepossibleoperatorsare:,gt,>=,ge,==,=,eq,!=,,nerespectively.在phpunit核心中使用here,您可以简单地将lt指定为值。例如:./tests/unit/test-file.php希望对你有帮助注

php - 错误 : The path to the driver executable must be set by the webdriver. gecko.driver 系统属性

我正在使用PHP进行自动化功能单元测试。我想使用PhpStorm在暂存环境上运行测试,我正在访问此链接:https://www.sitepoint.com/using-selenium-with-phpunit/.我已经完成了这段代码的任务:我访问过此链接但不适合我。Thepathtothedriverexecutablemustbesetbythewebdriver.gecko.driversystempropertysetHost('localhost');$this->setPort(4444);$this->setBrowserUrl('https://www.facebook

phpunit Mock 返回 null 而原始方法返回字符串

我有这个文件结构:-module--phpunit.xml--blaat.php--tests---blaatTest.phpblaat.php的内容classBlaat{publicfunctiondoSomething(){return'myreturnvalue';}}测试/blaatTest.php的内容usePHPUnit\Framework\TestCase;require_once'./blaat.php';classblaatTestextendsTestCase{publicfunctiontestCanBeCreatedFromValidEmailAddress()

php - 作为数组的一部分从 PHPUnit Test 返回参数

我想从此模拟方法返回一个数组,我希望它包含最初传递给该方法的参数之一。下面的代码运行但不是具有原始参数值的数据,而是类型的对象PHPUnit_Framework_MockObject_Stub_ReturnArgument$stub->method('insert')->willReturn(array('success'=>true,'data'=>$this->returnArgument(0)));我能够得到原始参数的唯一方法是只返回参数,但是我没有我需要的数组$stub->method('insert')->will('data'=>$this->returnArgument(

php - 如何将参数传递给 Controller ​​(测试)

我正在使用PHPUnit测试一个至少有一个参数的Controller:publicfunctiontestSomething($a,$b=''){}我正在尝试以这种方式进行测试:$params=array('a'=>'foo','b'=>'bar');$output=$this->request('POST',['MyController','Something'],$params);但是我得到:ArgumentCountError:ToofewargumentstofunctionMyController::Something如何传递这些参数?注意:我使用了一个将PHPUnit集成到

PHPUnit 测试 double

我开始使用PHPUnit来测试我的代码,但我在理解双重测试方面遇到了一些问题。我尝试对类方法b进行stub以在自另一个方法调用时返回true而不是通常的行为(false)我有这样的代码classMyClass{functiona(){return$this->b();}functionb(){returnfalse;}}classMyClassTestextendsTestCase{functiontestAThrowStubB(){$myClassStub=$this->getMockBuilder('\MyClass')->getMock();$myClassStub->expec