Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

4jZW7jVSdS4U6PC's avatar

Codeception + Homestead

Hello everyone.

I've already searched inside the forum but it seems that nobody posted a question on those tools together.

I'm working with Homestead every day, I'm using it because I can simply drag my environment from machine to machine, make a few configuration on my IDE (if it's new otherwise is already configured) and I'm ready to work, It's awesome.

I've only one problem, and it drives me crazy: My current project has tons of tests, vary from Acceptance to Functional and Unit, written with codeception but when I try to run vendor/bin/codecept run it shows me this error

GuzzleHttp\Exception\RequestException: cURL error 7: Failed to connect to http://web.laravelProject port 8000: Connection refused

Of course it's my fault somewhere, my hosts file has got this line 127.0.0.1 http://web.laravelProject but my Homestead doesn't have this line inside hosts file (does it need this in first place?)

In case you wonder here's my acceptance.yml file

# Codeception Test Suite Configuration

# suite for acceptance tests.
# perform tests in browser using the WebDriver or PhpBrowser.
# If you need both WebDriver and PHPBrowser tests - create a separate suite.

class_name: AcceptanceTester
modules:
    enabled:
        - PhpBrowser
        #- WebDriver
        - AcceptanceHelper
    config:
        PhpBrowser:
            url: 'http://web.laravelProject:8000'
        WebDriver:
            url: 'http://web.laravelProject:8000'
            wait: 1
            browser: chrome
            window_size: 1440x900
            capabilities:
              unexpectedAlertBehaviour: 'accept'

Hope everything is clear. Thank you for any answer.

0 likes
3 replies
austenc's avatar
austenc
Best Answer
Level 10

I run my tests from within the vm (ssh'd in), so I assume that's what you're doing too. Try removing the :8000 from your url definition in the .yml file.

Make sure you run codecept build once you've changed the yml files!

4 likes

Please or to participate in this conversation.