ProphecyPHP 5.3+ 模拟框架
Prophecy 是功能强劲且灵活的 PHP 5.3+ 的模拟框架。尽管它最初是用来满足 phpspec2 的需求,但是它足够灵活,并且可以在任何测试框架中使用。
示例代码:
<?php class UserTest extends PHPUnit_Framework_TestCase { private $prophet; public function testPasswordHashing() { $hasher = $this->prophet->prophesize('App\Security\Hasher'); $user = new App\Entity\User($hasher->reveal()); $hasher->generateHash($user, 'qwerty')->willReturn('hashed_pass'); $user->setPassword('qwerty'); $this->assertEquals('hashed_pass', $user->getPassword()); } protected function setup() { $this->prophet = new \Prophecy\Prophet; } protected function tearDown() { $this->prophet->checkPredictions(); } }
评论
FBMockPHP 模拟框架
FBMock是一个简单易用的PHP模拟测试框架(PHPMocksFramework)。不同于其他的模拟测试框架一样,FBMock只是stubswithspies,它并没有使用常见的DSL和也不依赖于o
FBMockPHP 模拟框架
0
PowerMock单元测试模拟框架
PowerMock也是一个单元测试模拟框架,它是在其它单元测试模拟框架的基础上做出的扩展。通过提供定制的类加载器以及一些字节码篡改技巧的应用,PowerMock现了对静态方法、构造方法、私有方法以及F
PowerMock单元测试模拟框架
0
jqMockjQuery模拟测试框架
jqMock是一个轻量级的JavaScript模拟测试框架,基于jqUnit单元测试框架。模拟测试代码:jqUnit.test('helloworldtest',function(){ varal
jqMockjQuery模拟测试框架
0
CaptureMockPython 模拟测试框架
CaptureMock提供Python模拟的捕获-重放功能,建立在命令行和客户机-服务器通信的基础上。CaptureMock所谓的方法就是捕获-重放方法。它在用户‘记录’模拟子系统的时候观察代码和模拟
CaptureMockPython 模拟测试框架
0