mockery

    1热度

    2回答

    我是Laravel和IoC的概念的新手。我在一个Nettuts(http://net.tutsplus.com/tutorials/php/testing-laravel-controllers/)上跟踪了很棒的教程,并能够成功测试我的控制器。但是我想通过嘲笑数据库来隔离控制器。当我试图将我的嘲笑对象注入的IoC我得到以下错误: Cannot modify header information -

    0热度

    2回答

    有没有办法在测试类的构造函数/类的setUp函数中创建一个模拟,以便模拟可用于所有测试方法? 我试图像创建在构造函数中: public class testMocks extends PHPUnit_Framework_TestCase { protected $mock; public function __construct() { $this->

    0热度

    1回答

    我已经安装了Pear并使用Pear来安装PHPUnit和Mockery。 我有PHPUnit在elipse中成功运行(pear目录被配置为项目中的包含路径)。 我想用嘲弄,但日食不断给我这个错误: PHP Fatal error: Class 'deepend\Mockery' not found 我这里遵循的忠告:http://pkp.sfu.ca/wiki/index.php/Configur

    4热度

    2回答

    这可能是我对嘲笑的误解。我真的很感激解释为什么嘲笑一个不存在的或现存的课堂是件好事? 示例场景:假设我们有一个类依赖于第二类的输出,并且我们更改输出格式或其他。这不会让我们的测试成功,虽然他们已经过时了头等舱吗?

    0热度

    1回答

    public function __call($method, $args) { if (! in_array($method, $this->validMethods)) { throw new \BadMethodCallException("Not a valid method: {$method}"); } } 如何测试__call方法以

    12热度

    1回答

    $client = Mockery::mock(); $client->shouldReceive('send')->andThrow($error)->andReturn(true); 不幸的是,它只返回true,但不是首先抛出异常。如何在第一次调用时抛出异常,然后在第二次调用该方法时返回值? 编辑: 这工作如果我手动编辑Mockery\Expectation.php并设置$_throw

    1热度

    1回答

    我有这个类: class PagSeguro { public function pay() { if (! $this->checkAllData()) { return false; } return $this->buildPaymentURL(); } private functio

    1热度

    2回答

    任何人都嘲笑嘲笑?当我试图创建狂饮客户端模拟我得到异常: ErrorException: Runtime Notice: Declaration of Mockery_517a66dfe36b0::__call() should be compatible with Guzzle\Service\Client::__call($method, $args = NULL) 这里是代码: $moc

    -1热度

    1回答

    我有一个模型,重载where函数。 我的重载的方法是这样的: public function where($column, $operator = null, $value = null, $boolean = 'and') { if (in_array($column, $this->metaFields)) { $value = '%"' . $column

    1热度

    1回答

    我有一个类名称作为字符串属性。一种方法(fetchObject)创建此类的新实例。我想用PHPUnit和Mockery来测试这个方法。 这是代码 class Maker { private $_className = 'Article'; public function fetchObject($array) { return new $this->_