我正在尝试模拟phpunit的类。php单元因错误而失败Could not load mock ... class already exists。这是我正在运行的唯一测试,因此不可能已经模拟了该类。
任何建议,将不胜感激。
这是错误情况:
namespace Tests\Feature;
use Tests\TestCase;
class DeactivateACSTest extends TestCase
{
public function testDeactivateAcs()
{
$deviceController = \Mockery::mock('overload:App\Http\Controllers\Cloud\DeviceController');
$deviceController
->shouldReceive('deactivateACS')
->andReturn('hilfehilfehilfe');
$devCon = new \App\Http\Controllers\Cloud\DeviceController();
$this->assertEquals('hilfehilfehilfe', $devCon->deactivateACS());
}
}
Run Code Online (Sandbox Code Playgroud)
在没有--code-coverage它的情况下运行时:
[13:10:15] vagrant@homestead [~/Code/ekp] $ phpunit --filter DeactivateACS
PHPUnit 6.5.10 by Sebastian Bergmann and contributors.
==> Tests\Feature\DeactivateACSTest ?
Time: 1.08 seconds, Memory: 16.00MB
OK (1 test, 3 assertions)
Run Code Online (Sandbox Code Playgroud)
但是,与--code-coverage它一起运行时失败:
[13:10:23] vagrant@homestead [~/Code/ekp] $ phpunit --coverage-html coverage --coverage-text=code_coverage.txt …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用instagram-oauth gem建立与Instagram API的连接.但是,当我打开oauth网址时,我无法通过Facebook登录我的Instagram帐户.仅显示用户名/密码.我是否必须激活Facebook登录支持?
我正在升级主要服务于JSON的rails应用程序.我能够升级到的最后一个工作版本是4.1.升级到4.2后,请求在测试日志中产生奇怪错误的规范:
Could not log "render_template.action_view" event. NoMethodError: undefined method `render_views?' for #<Class:0x007fe544a2b170>
Run Code Online (Sandbox Code Playgroud)
在某处我读到这是因为rails尝试渲染不存在的视图.在跳到rails 4之前,我们设置好了headers['CONTENT_TYPE'] = 'application/json'一切.我读到这不再适用于rails 4.我已经尝试添加format: :json,如下所示:将Rspec默认GET请求格式设置为JSON,这没有帮助.
如何获得规格再次运行的任何帮助将不胜感激.