Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"require": {
"php": ">=5.4.0",
"codeception/codeception": "*",
"guzzle/guzzle": "~3.9"
"guzzlehttp/guzzle": "~6.0"
},
"autoload": {
"psr-4": {
Expand Down
15 changes: 9 additions & 6 deletions src/Mailtrap.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php namespace Codeception\Module;

use Codeception\Module;
use GuzzleHttp\Client;
use Guzzle\Http\Client;

/**
* This module allows you to test emails using Mailtrap <https://mailtrap.io>.
Expand Down Expand Up @@ -56,9 +56,9 @@ class Mailtrap extends Module
*/
public function _initialize()
{
$this->client = new Client([
'base_url' => [$this->baseUrl, ['version' => $this->config['version']]],
'defaults' => [
$this->client = new Client($this->baseUrl, [
'version' => $this->config['version'],
'request.options' => [
'headers' => ['Api-Token' => $this->config['client_id']],
],
]);
Expand Down Expand Up @@ -213,7 +213,9 @@ public function seeInEmailHtmlBody($expected)
*/
protected function fetchLastMessage()
{
$messages = $this->client->get("inboxes/{$this->config['inbox_id']}/messages")->json();
$messages = $this->client->get("inboxes/{$this->config['inbox_id']}/messages")
->send()
->json();

return array_shift($messages);
}
Expand All @@ -225,6 +227,7 @@ protected function fetchLastMessage()
*/
public function cleanInbox()
{
$this->client->patch("inboxes/{$this->config['inbox_id']}/clean");
$this->client->patch("inboxes/{$this->config['inbox_id']}/clean")
->send();
}
}