mockery

    2热度

    1回答

    我需要嘲笑Laravel的Eloquent \模型与嘲笑,这是有点棘手,因为它使用静态方法。 我用下面的代码解决了这个问题,但我想知道是否有更好/更聪明的方法来做到这一点。 <?php use Ekrembk\Repositories\EloquentPostRepository; class EloquentPostRepositoryTest extends TestCase {

    1热度

    1回答

    我一直试图使用Mockery来声明,在抛出异常时从另一个方法内调用方法。因此,作为一个例子: public function testOtherMethodIsCalled() { $client = m::mock('Client'); $client ->shouldReceive('getFoo') ->andThrow(new FooNotAv

    0热度

    1回答

    我注意到Codeception可以选择sqlite:memory。在这种情况下,我应该选择退出嘲笑吗? 我的理解是Mockery启用测试以避免触击数据库。通过上面提到的Codeception选项,我可以用样本数据对数据库进行种子处理,并将其打入内存中。 当我与Selenium2和PhantomJS把这个在一起,一些测试从15秒将1秒Laravel 4

    1热度

    1回答

    我尝试在嘲笑中测试我的控制器在laravel中的操作。我已阅读本教程在这里: http://culttt.com/2013/07/15/how-to-structure-testable-controllers-in-laravel-4/ 我用DI在我的构造是这样的: public function __construct(User $user, Cartalyst\Sentry\Sentry $

    0热度

    2回答

    我有以下测试: public function testTestNameRequired(){ Validator::shouldReceive("make")->once() ->with(array(1,2,3), hasKeyValuePair("name",array("required"))) ->andReturn(m::mock(["passes"=

    2热度

    1回答

    使用PHPUnit进行测试,我的测试在函数上失败。但我不知道为什么。 的功能,我想嘲笑: public function subscribe($email) { $message = new SubscribeMessage(); $message->setEmailaddress($email); $message->setLocale(Locale::getDe

    2热度

    1回答

    使用下面的指南,我试图让嘲弄的窍门: Zend Db Adapter Adapter Mocking with mockery和 Database and Models Testing (我CommissionTable扩展AbstractTableGateway它的构造是通过数据库适配器) 我有以下的(适配器嘲讽链接): protected function getAdapterMock() {

    7热度

    2回答

    在PHP接口时 我曾嘲笑在PHP中使用嘲弄(即时通讯使用的laravel框架接口时遇到一个问题,但我不知道这是相关的。 我已经定义的接口 <?php namespace MyNamespace\SomeSubFolder; interface MyInterface { public function method1(); } 而且我有typehints上的方法,一个接口的

    0热度

    1回答

    在我所要测试的功能,我有以下检查 if (!is_callable(array($object, $methodName))) { throw new \InvalidArgumentException( sprintf( 'Unable to call method %s::%s() on object $%s', get_class($object

    0热度

    1回答

    我正在为使用Predis连接到Redis数据库的类设置一些单元测试。我试图嘲笑Client和Connection对象,以便我可以进行单元测试。 这是我的班,与Predis客户对象涉及的部分: public function __construct(Predis\Client $redis = null){ $this->_redis = $redis; $this->_vali