Blog & Stuff

Quick way to mock data for Behat in Laravel

Posted: 2015-03-30 00:05:20

Below allows me to use this type of step in my tests

Scenario: Given I update a Domain get 200
Given I mock "App\Sites\Domain" with properties:
"""
id: "mock-update-1"
site_id: "mock-site-1"
domain: "foo2.com
"""
Given I have the payload:
"""
{
"data":
{
"id": "mock-update-1",
"site_id": "mock-site-1",
"domain": "foo2.com"
}
}
"""
Then I request "PUT /api/v1/sites/mock-site-1/domains/mock-update-1"
Then I get a "200" response