Search code examples
curllaravelcodeceptionlaravel-5

Error codeception requires CURL extension installed


Ok I'm using laravel 5 going through the tutorial series on Larabook and I'm stuck at trying to use Codeception. My laravel application folder name is "larabook"

Running vendor/bin/codecept from my larabook folder works correctly giving me the list of options. I then initialized it and that worked. I created a SignUpCept.php file as instructed and filled it with the following.

<?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!');

But when I run "vendor/bin/codecept run functional" I get the following error..

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

Now if I type curl --help I get the list of options which means it's installed right so why is this happening? I'm using windows with vagrant and virtualbox and laravel 5.

My "tests" folder is in the root of my larabook folder and my codeception.yml file looks like so.

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

I also have my .env.testing.php setup correctly aswell in the root of larabook.


Solution

  • Running

    $ curl --help 
    

    means the unix command line curl program is installed on your system.

    This also means the unix curl libraries are installed on your system.

    It does not mean that PHP curl extension is installed on your PHP system.

    Create a small test file with the following PHP code

    phpinfo();
    

    It will list all the extensions PHP has installed. My guess is the PHP curl extension isn't installed.

    Remember that the command line version of PHP you're using might be different than the web version of PHP you're using.