-
Notifications
You must be signed in to change notification settings - Fork 86
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #78 from mailjet/v3.1_smart
V3.1 smart
- Loading branch information
Showing
6 changed files
with
190 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,4 @@ | ||
<?php | ||
/** | ||
* PHP version 5 | ||
* | ||
* This is the Mailjet Resources file | ||
* | ||
* @category Mailjet_API | ||
* @package Mailjet-apiv3 | ||
* @author Guillaume Badi <[email protected]> | ||
* @license MIT https://opensource.org/licenses/MIT | ||
* @link dev.mailjet.com | ||
*/ | ||
|
||
namespace Mailjet; | ||
|
||
/** | ||
|
@@ -26,7 +14,7 @@ | |
*/ | ||
class Resources | ||
{ | ||
public static $Email = ['send', '']; | ||
public static $Email = ['send', ''/*, 'v3.1'*/]; | ||
public static $Aggregategraphstatistics = ['aggregategraphstatistics', '']; | ||
public static $Apikey = ['apikey', '']; | ||
public static $Apikeyaccess = ['apikeyaccess', '']; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,9 +6,9 @@ | |
|
||
class MailjetTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
private function assertUrl($url, $response) | ||
private function assertUrl($url, $response, $version = 'v3') | ||
{ | ||
$this->assertEquals('https://api.mailjet.com/v3'.$url, $response->request->getUrl()); | ||
$this->assertEquals('https://api.mailjet.com/'.$version.$url, $response->request->getUrl()); | ||
} | ||
|
||
public function assertPayload($payload, $response) | ||
|
@@ -24,7 +24,7 @@ public function assertFilters($shouldBe, $response) | |
|
||
public function testGet() | ||
{ | ||
$client = new Client('', '', false); | ||
$client = new Client('', '', ['call' => false]); | ||
|
||
$this->assertUrl('/REST/contact', $client->get(Resources::$Contact)); | ||
|
||
|
@@ -51,7 +51,7 @@ public function testGet() | |
|
||
public function testPost() | ||
{ | ||
$client = new Client('', '', false); | ||
$client = new Client('', '', ['call' => false]); | ||
|
||
$email = [ | ||
'FromName' => 'Mailjet PHP test', | ||
|
@@ -67,4 +67,21 @@ public function testPost() | |
$this->assertUrl('/send', $ret); | ||
$this->assertPayload($email, $ret); | ||
} | ||
|
||
public function testPostV3_1() | ||
{ | ||
$client = new Client('', '', ['call' => false]); | ||
|
||
$email = [ | ||
'Messages' => [[ | ||
'From' => ['Email' => "[email protected]", 'Name' => "Mailjet PHP test"], | ||
'TextPart' => "Simple Email test", | ||
'To' => [['Email' => "[email protected]", 'Name' => 'Test']] | ||
]] | ||
]; | ||
|
||
$ret = $client->post(Resources::$Email, ['body' => $email], ['version' => 'v3.1']); | ||
$this->assertUrl('/send', $ret, 'v3.1'); | ||
$this->assertPayload($email, $ret); | ||
} | ||
} |