Skip to content

Problem with the parameterBag in RestApiContext #16

@ockam

Description

@ockam

I’m using your package in a Laravel 5.4 project and this is my first experience with Behat.

When running Behat, I get the followiing error:

Fatal error: Call to a member function replace() on null (Behat\Testwork\Call\Exception\FatalThrowableError)

I trace it back to the extractFromParameterBag method in RestApiContext.
$this->getParameterBag() is null.
If I plainly return the string (commenting out line 688), it works fine.

Am I missing a configuration?

Here’s by behat.yml:

default:
    extensions:
        Laracasts\Behat:
            # env_path: .env.behat
        Behat\MinkExtension:
            default_session: laravel
            laravel: ~
        Ulff\BehatRestApiExtension\ServiceContainer\BehatRestApiExtension: ~

My feature:

Feature: Programs

    In order to use the API for programs
    As a user
    I need to get data in JSON

    Scenario: List all programs
        When I make request "GET" "/api/v1/programs"
        Then the response status code should be 200
        And the response JSON "data" field should be a collection

And my FeatureContext:

<?php

use Ulff\BehatRestApiExtension\Context\RestApiContext;

class FeatureContext extends RestApiContext
{
    public function __construct()
    {
    }

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions