imbo / behat-api-extension

API extension for Behat, used to ease testing of JSON-based APIs
MIT License
109 stars 42 forks source link

Attaching files does not work #5

Closed christeredvartsen closed 8 years ago

christeredvartsen commented 8 years ago

The Given I attach :path to the request as :partName step does not work as expected as it sets the part as a string instead of a file resource:

Instead of:

$part = [
    'name' => $partName,
    'contents' => file_get_contents($path),
];

it should be doing this:

$part = [
    'name' => $partName,
    'contents' => fopen($path, 'r'),
    'filename' => basename($path),
];