mailgun-php/tests/Api/RoutesTest.php

42 lines
849 B
PHP
Raw Normal View History

Routes API (#249) * Add initial (empty) Routes PHP Unit Test file We still need to provide the automated tests * Add initial Routes file * Describe API Methods * Inherit method from TestCase - adding @inheritdoc annotation * Add new DTOs to map API responses to known objects * Add new Response to manage the Routes list * Implement method to retrieve a list of Routes * Add new Response to manage a single Route resource * Implement method to retrieve a single Route * Set ShowResponse as final * Add new Response to manage the Create process * Implement method to create a new Route * Fix missing annotation * Add new Response to manage the Delete Route process * Implement method to delete a Route based on the ID * Add new Response to manage the Update Route process This response is based on Domain API docs due there are no examples on Routes API docs. We may need to update the response. * Implement method to update a Route based on the ID * Require a $limit value greater than 0 * Require a $skip value greater than or equal to 0 * Set UpdateResponse as final * Add new (empty) public methods to test the Routes API * Provide method to get the Routes API from Mailgun Client * Add missed annotation * Update ShowResponse to return an instance of ApiResponse instead of the DTO * Update annotation * Fix annotation * Update array $actions to provide an empty array by default * Update parameters to make sure the last arg always is a DateTime (or null) * Use empty() * Remove DTO suffix * Move DTOs to the parent folder/namespace * Fix annotations
2016-12-10 01:15:06 +03:00
<?php
/*
* Copyright (C) 2013-2016 Mailgun
*
* This software may be modified and distributed under the terms
* of the MIT license. See the LICENSE file for details.
*/
namespace Mailgun\Tests\Api;
use GuzzleHttp\Psr7\Response;
Routes API (#249) * Add initial (empty) Routes PHP Unit Test file We still need to provide the automated tests * Add initial Routes file * Describe API Methods * Inherit method from TestCase - adding @inheritdoc annotation * Add new DTOs to map API responses to known objects * Add new Response to manage the Routes list * Implement method to retrieve a list of Routes * Add new Response to manage a single Route resource * Implement method to retrieve a single Route * Set ShowResponse as final * Add new Response to manage the Create process * Implement method to create a new Route * Fix missing annotation * Add new Response to manage the Delete Route process * Implement method to delete a Route based on the ID * Add new Response to manage the Update Route process This response is based on Domain API docs due there are no examples on Routes API docs. We may need to update the response. * Implement method to update a Route based on the ID * Require a $limit value greater than 0 * Require a $skip value greater than or equal to 0 * Set UpdateResponse as final * Add new (empty) public methods to test the Routes API * Provide method to get the Routes API from Mailgun Client * Add missed annotation * Update ShowResponse to return an instance of ApiResponse instead of the DTO * Update annotation * Fix annotation * Update array $actions to provide an empty array by default * Update parameters to make sure the last arg always is a DateTime (or null) * Use empty() * Remove DTO suffix * Move DTOs to the parent folder/namespace * Fix annotations
2016-12-10 01:15:06 +03:00
/**
* @author David Garcia <me@davidgarcia.cat>
*/
class RoutesTest extends TestCase
{
protected function setUp()
{
$this->markTestSkipped('Routes API tests not implemented yet.');
}
public function testCreate()
{
$api = $this->getApiMock();
$api->expects($this->once())
->method('httpPost')
->willReturn(new Response());
$api->create('catch_all()', ['forward("mailbox@myapp.com")'], 'example', 100);
}
Routes API (#249) * Add initial (empty) Routes PHP Unit Test file We still need to provide the automated tests * Add initial Routes file * Describe API Methods * Inherit method from TestCase - adding @inheritdoc annotation * Add new DTOs to map API responses to known objects * Add new Response to manage the Routes list * Implement method to retrieve a list of Routes * Add new Response to manage a single Route resource * Implement method to retrieve a single Route * Set ShowResponse as final * Add new Response to manage the Create process * Implement method to create a new Route * Fix missing annotation * Add new Response to manage the Delete Route process * Implement method to delete a Route based on the ID * Add new Response to manage the Update Route process This response is based on Domain API docs due there are no examples on Routes API docs. We may need to update the response. * Implement method to update a Route based on the ID * Require a $limit value greater than 0 * Require a $skip value greater than or equal to 0 * Set UpdateResponse as final * Add new (empty) public methods to test the Routes API * Provide method to get the Routes API from Mailgun Client * Add missed annotation * Update ShowResponse to return an instance of ApiResponse instead of the DTO * Update annotation * Fix annotation * Update array $actions to provide an empty array by default * Update parameters to make sure the last arg always is a DateTime (or null) * Use empty() * Remove DTO suffix * Move DTOs to the parent folder/namespace * Fix annotations
2016-12-10 01:15:06 +03:00
/**
* {@inheritdoc}
*/
protected function getApiClass()
{
return 'Mailgun\Api\Routes';
}
}