2014-10-08 96 views
0

好吧我正在使用laravel 5通过Larabook教程系列,我坚持试图使用Codeception。我的laravel应用程序文件夹名称是“larabook”错误codeception需要CURL扩展安装

从我的larabook文件夹运行供应商/ bin/codecept可以正确地给我提供选项列表。然后我初始化了它并且工作。按照说明创建了一个SignUpCept.php文件,并填入以下内容。

<?php 

$I = new FunctionalTester($scenario); 
$I->am('a guest'); 
$I->wantTo('Sign up for a Larabook acount'); 

$I->amOnPage('/'); 
$I->click('Sign Up'); 
$I->seeCurrentUrlEquals('/register'); 

$I->fillField('Username:', 'JohnDoe'); 
$I->fillField('Email:', '[email protected]'); 
$I->fillField('Password:', 'demo'); 
$I->fillField('Password Confirmation:', 'demo'); 
$I->click('Sign Up'); 

$I->seeCurrentUrlEquals(''); 
$I->see('Welcome to Larabook!'); 

但是当我运行“供应商/斌/ codecept运行功能”,我得到以下错误..

[Exception] 
Codeception requires CURL extension installed to make tests run. 

现在如果我型卷曲--help我得到的选项列表,这意味着它的安装正确,为什么会发生这种情况?我使用的是vagrant和virtualbox以及laravel 5的windows。

我的“测试”文件夹位于我的larabook文件夹的根目录,我的codeception.yml文件看起来像这样。

actor: Tester 
paths: 
    tests: tests 
    log: tests/_output 
    data: tests/_data 
    helpers: tests/_support 
settings: 
    bootstrap: _bootstrap.php 
    colors: false 
    memory_limit: 1024M 
modules: 
    config: 
     Db: 
      dsn: '' 
      user: '' 
      password: '' 
      dump: tests/_data/dump.sql 

我也有我的.env.testing.php设置正确以及larabook的根。

回答

0

运行

$ curl --help 

表示UNIX命令行卷曲程序安装到系统上。

这也意味着您的系统上安装了unix卷曲库。

不是表示PHP curl扩展安装在您的PHP系统上。

与下面的PHP代码

phpinfo(); 

它会列出PHP安装了所有扩展创建一个小的测试文件。我的猜测是未安装PHP curl扩展。

请记住,您使用的PHP的命令行版本可能与您使用的PHP的Web版本不同。

+0

啊好吧我知道我不得不启用php.ini中的扩展测试。谢谢! – user300979 2014-10-08 17:24:01

0

就像@Alan所说的,如果你没有安装curl for php,在我遇到类似错误的情况下,我简单地安装它(在Ubuntu 15上)。10),之后我codeception测试跑

sudo apt-get install php5-curl 

PS:如果你是root权限已如果你使用phpbrew可以安装卷曲扩展你不需要须藤

0

phpbrew ext install curl 

在错误的情况下安装这个库:

sudo apt install libcurl4-openssl-dev 

注:此溶液在Ubuntu 16