Commit Graph

209 Commits

Author SHA1 Message Date
Nathan Perkins
2db0619d8a Revise domain creation assertions and add tests
Based on feedback from @DavidGarciaCat.
2019-08-29 22:25:39 +01:00
Tobias Nyholm
c3ea40c94e
Fixed a few PRs and some cleanup (#589)
* fix for #581

* fix for #582

* Remove final

This will fix #584

* Type cast to string properly

* Convert to json string if needed

* cs
2019-04-09 20:37:32 +02:00
Louis Coulet
7705cb7666 Fix attachment and inline image renaming (#571)
* Fix file renaming

* Fix file renaming
2019-04-09 19:12:50 +02:00
Tobias Nyholm
6954b4dd2a
Use PSR-18 (#522)
* Use PSR-18

* minor fixes

* phpstan fixes

* cs
2019-02-02 08:30:04 +01:00
Nyholm
997d545e61 Bugfixes 2019-01-20 11:03:18 +00:00
Nyholm
3fbd33f640 Make sure we dont use any risky tests 2019-01-12 16:56:42 +00:00
Nyholm
0f54332d0e CS and fixes 2019-01-12 10:34:44 +00:00
Nyholm
2ec2c16227 Added PHP7 code and did some refactoring. 2019-01-12 10:34:44 +00:00
Nyholm
2b60fba811 Moved Mailgun\Model\Route\Response to Mailgun\Model\Route 2019-01-12 10:28:05 +00:00
David Garcia
f3566026b6 Remove egulias/email-validator and dependencies 2019-01-10 22:15:40 +00:00
David Garcia
f775795b85 Test EmailValidation Model 2019-01-10 22:15:40 +00:00
David Garcia
34b33a9127 Add Header comment 2019-01-10 22:15:40 +00:00
David Garcia
df7043343e Test Parse model for Parseable and Unparseable data 2019-01-10 22:15:40 +00:00
David Garcia
6fc5b1e938 Test Parts model 2019-01-10 22:15:40 +00:00
David Garcia
8cb9a0e48a Provide test to parse a valid email address 2019-01-10 22:15:40 +00:00
David Garcia
2c37651097 Remove non-required tests
Egulias/EmailValidator validates these cases,
is useless to test it
2019-01-10 22:15:40 +00:00
David Garcia
18d948be0f Provide test to validate a valid email address 2019-01-10 22:15:40 +00:00
David Garcia
3f097bb178 Add EmailValidationTest 2019-01-10 22:15:40 +00:00
Nyholm
dd7c1d2361 Added new CS rules
Declare strict and no superfluous phpdoc
2019-01-10 08:25:29 +00:00
Nyholm
6dff177387 typo 2019-01-09 20:51:05 +00:00
Nyholm
f915b103a3 cs 2019-01-09 20:51:05 +00:00
Nyholm
b619b66732 Adding tag aggregates 2019-01-09 20:51:05 +00:00
Tobias Nyholm
b725ab728e
Adding PHP7 type annotations (#523)
* Adding PHP7 type annotations

* cs

* Moved HttpClientConfigurator and RequestBuilder to Mailgun\HttpClient namespace

* fixing tests

* Rebased and fixed tests

* minors

* cs

* Bugfixes

* Typo
2019-01-09 20:18:58 +01:00
Tobias Nyholm
519fd7a674
Added proper PHP CS fixer rules (#527)
* Added proper PHP CS fixer rules

* Adding Symfony cs rules

* Updated CS on tests
2019-01-07 06:12:53 +01:00
Tobias Nyholm
e341a44a5c
Removed deprecated code (#521)
* Removed deprecated code

* cs

* Removed more deprecated code

* minor
2019-01-06 10:07:06 +01:00
Tobias Nyholm
da5ccde2a7
Adding support for Mailing list (#514)
* Adding Mailing list API

* Added tests

* cs

* Fixed the tests

* code cleanup
2019-01-06 08:11:37 +01:00
Tobias Nyholm
56655ad6c0
Added IP API class, models and test (#515)
* Added IP API class, models and test

* cs

* bugfix
2019-01-05 20:31:38 +01:00
Tobias Nyholm
c0a386027b
Added more tests for models (#511)
* Added more tests for models

* cs
2019-01-05 20:30:55 +01:00
Tobias Nyholm
09113482ea
Added "complaints" to TotalResponse (#509) 2019-01-05 19:56:55 +01:00
Paul R Rogers
02e3191bc9 Change exception message of HttpClientException when badRequest to us… (#466)
* Change exception message of HttpClientException when badRequest to use server content's message to aid resolving problems with user input.

* style(HttpClientException): Removed space to comply with styleCI.

* Fix missing assoc flag.

* Refactor to reuse constructor parsing when passing along server error.
Add tests covering passing along of server message.

* Updated tests

* cs

* bugfix
2019-01-05 12:52:40 +01:00
Matias Barletta
07da83776a fix: Validate file name length (#463)
* fix: Validate file name length

$message could contain a large email text that if sent to is_file it could break with this error:
` is_file(): File name is longer than the maximum allowed path `
This validation prevents using is_file if the $message is longer than the allowed path.

* style: Fix extra space

* Added a small test

* cs

* cs
2019-01-05 12:44:50 +01:00
Tobias Nyholm
d4e4d4efbe
Close open resources (#473)
* Make sure to close any open resources

* Fixed test
2019-01-05 08:23:41 +01:00
Arliee
1f5bd4200d Fix type error when creating tags (#501)
* Fix fatal error due to not using DateTime instead of string when creating a tag.

* Add unit tests to prove tag creation.

* Add unit tests to prove tag creation.

* Add first seen and last seen accessors to tags, and unit tests to prove correctness.
2019-01-03 10:55:24 +01:00
Tobias Nyholm
bec1da39aa
Removed integration tests. (#490) 2018-12-09 11:45:32 +00:00
Tobias Nyholm
a4aba16061
Added a way to get attachments (#476)
* Added a way to get attachments

* Added some tests

* cs

* minor

* Removed declare_strict

* Typos

* Bugfixes

* Fixed bugs
2018-08-09 18:59:38 +02:00
Nyholm
0c70fa1f0e Make BaseModelTest abstract 2018-08-08 20:50:52 +01:00
Nyholm
6229b39aa3 cs 2018-08-08 20:50:52 +01:00
Nyholm
0145ddd481 Added more tests 2018-08-08 20:50:52 +01:00
Nyholm
61c0f32dfb cs 2018-08-08 20:50:52 +01:00
Nyholm
17eafbf9c9 Added tests for our models 2018-08-08 20:50:52 +01:00
Nyholm
1835bc28d7 cs 2018-08-08 20:48:35 +01:00
Nyholm
1ed1c2557c Added test for webhook 2018-08-08 20:48:35 +01:00
Nyholm
6e209aaee2 Added Unsubscribe test 2018-08-08 20:48:35 +01:00
Nyholm
fa30639f99 Added complaint test 2018-08-08 20:48:35 +01:00
Nyholm
55547572aa Added bounce test 2018-08-08 20:48:35 +01:00
Nyholm
d6e48c6bc2 Added test for Message API 2018-08-08 20:48:35 +01:00
Nyholm
15bd5ae156 Added tests for Route 2018-08-08 20:48:35 +01:00
Nyholm
42503f72ce Added test for Domain API 2018-08-08 20:48:35 +01:00
Nyholm
afc8671eac We need both getApiMock and getApiInstance 2018-08-08 20:48:35 +01:00
Nyholm
75bab3016c cs 2018-08-08 20:48:35 +01:00
Nyholm
3d81db203e Add tests 2018-08-08 20:48:35 +01:00
Nyholm
bdcca2db0d Added more mock for tests 2018-08-08 20:48:35 +01:00
Tobias Nyholm
eb07576e6a
Ported MessageBuilder and BatchMessage (#472)
* Ported MessageBuilder and BatchMessage

* Added test for MessageBuilder

* Added test for BatchMessageTest

* cs

* cs

* Removed PHP7 code
2018-08-04 21:30:15 +02:00
Radoje Albijanic
83c5f76f87 Cast campaign ID-s to string (#460)
* 413 error proper handle.

* Cast campaign id-s to string. Added tests for that.

* Style fixes
2018-04-09 18:51:09 +02:00
Quentin
869eff42e1 style: Fix coding style. 2018-02-01 22:42:12 +00:00
Quentin
84734cf758 refactor: Remove dead code. 2018-02-01 22:42:12 +00:00
Quentin
ef5336450e chore(unsubscribe): Add copyright. 2018-02-01 22:42:12 +00:00
Quentin
ce2bd4b0f1 feat(unsubscribe): Handle tags in Unsubscribe v3 api. 2018-02-01 22:42:12 +00:00
François-Xavier de Guillebon
b73adaf60c Fixed stats retrieval (#384)
* [Stats] Fixed stats always empty

* Added tests
2017-12-01 21:10:21 +01:00
Hannes Magnússon
ce484ecbc8 Grammar typo (#413)
* Grammar typo

* Fixed style errors as reported by styleci
2017-11-22 09:37:04 +01:00
maximzasorin
e800038f21 Add domain verification (#370) 2017-06-22 19:35:42 +02:00
Temirkhan
6d56fa6a0d Few test corrections to preview where it goes. (#358)
* Few test corrections to preview where it goes.

* Removed TODO. Fixed dependency
2017-05-22 13:47:11 +02:00
Tobias Nyholm
487c1edd77 Prepare for release 2.3.2 (#352)
* Style fixes

* Added changelog
2017-05-16 15:20:33 +02:00
Alexandre Dupuy
d504472206 fix: named addresses must be surrounded by double quotes (#349)
* fix: named addresses must be surrounded by double quotes

Due to your recent API update, named addresses with special chars (like parentheses) are now rejected if they are surrounded by simple quotes
They must be surrounded by double quotes

'Whoever (SomeCompany)' <some@address.com> is no longer valid and will be rejected by your API
"Whoever (SomeCompany)" <some@address.com> is valid and will be OK

* sprintf instaead of old school concatenation
2017-05-16 14:51:02 +02:00
Tobias Nyholm
e30955fa51 Do not skip route test (#342) 2017-04-14 10:59:35 +02:00
Tobias Nyholm
d4ab1b0a87 Support mime messages (#341)
* Support mime messages

* cs

* Removed pointless integration tests

* typo

* Create new endpoint for message.mime

* cs

* Added docs

* Doc fixes

* Refactor
2017-04-14 10:31:13 +02:00
Tobias Nyholm
fab86bbef3 Make integrationt tests safe to run simultaneously (#338)
* Make integrationt tests safe to run simultaneously

* cs

* We only have the credentials when we do not make a PR
2017-04-08 11:22:20 +02:00
z38
edcfcc397f Add integration tests for Route API (#334) 2017-04-08 10:34:57 +02:00
z38
b713364dc0 Fix integration tests for domain API (#294)
* Send multipart/form-data requests by default

* Fix integration tests for Domain API
2017-04-07 18:24:48 -05:00
z38
0bc0a3b1a5 Fix disordered POST parameters (#279) 2017-04-07 18:24:37 -05:00
Tobias Nyholm
84fb433061 Renamed Routes to Route (#308)
* Renamed Routes to Route

Class names should be in singlular

* Update namespaces
2017-03-26 16:11:33 +02:00
Tobias Nyholm
0eb15969b9 Made most classes final (#310)
* Made most classes final

* bugfix
2017-03-26 10:49:33 +02:00
James Kraus
d2638a0457 Bug fix - Allow adding custom headers with non-array value (#255)
* Bug fix - Allow adding custom headers with non-array value

* Remove whitespace

* Functional test for adding custom headers (either singular or multiple)

* Style fixes for functional test
2017-03-26 10:23:03 +02:00
Tobias Nyholm
0f4fe2bf9c Improving safe hydrate (#307)
* Improving safe deseriliaze

* Fixes

* Use switch statement

* cs

* bugfix

* Update method name

* Update return docs
2017-03-26 10:16:36 +02:00
Tobias Nyholm
e74d7ad130 Added test for Route::Create (#306)
* Added test for Route::Create

* cd
2017-03-25 14:02:11 +01:00
Tobias Nyholm
1bfd40721e Added factory methods (#304)
* Added factory methods

* Removed urelated code

* Update test code
2017-03-25 13:48:03 +01:00
Tobias Nyholm
84a5c5dd4a Rename deserializer to hydrator (#296)
* Renamed "deserializer" to "hydrator"

* Make sure we use singlular in namespaces

Also did some cleanups.

* Fixed typo

* cs

* minor fix
2017-03-22 07:44:08 +01:00
z38
b3f24e9d7a Fix setting Reply-To multiple times (#300) 2017-03-14 16:51:33 +01:00
Sergei Beregov
718547a273 #276 additional method to get an attachment (#277)
* #276 additional method to get an attachment

* #276 fix code style

* Add Mailgun::getAttachment + test

* code style fix
2017-02-28 08:10:04 +01:00
Michal Hanajík
74929b6518 Renamed namespace from Resource\Api to Model (#293)
* Renamed namespace from Resource\Api to Model

* Moved Resources\ApiResponse to Models namespace

Signed-off-by: Michal Hanajík <michal.hanajik@outlook.com>

* Fix of code style
2017-02-23 20:56:30 +01:00
Tobias Nyholm
d5a49f2e6d Tag api (#286)
* Started on tag api

* Added TagAPI

* code style

* cs

* removed final

* Adjusting to Davids feedback.

* Added PagingProvider interface
2017-02-21 08:22:57 +01:00
Sean Johnson
e177e13a0c Update boundary regex to match RFC1341 (#283)
* Update boundary regex to match RFC1341
2017-02-18 10:53:21 -06:00
David Garcia
1613843c7e 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-09 14:15:06 -08:00
Sean Johnson
ce8215ff6c Apply fixes from StyleCI (#243) 2016-12-06 12:12:52 -06:00
Tobias Nyholm
61a019ad67 Fixed integration tests (#233)
* Fixed integration tests

* Update integration tests

* cs
2016-11-24 09:59:05 +01:00
Sean Johnson
ce9739ea91 Applied fixes from StyleCI (#228) 2016-11-23 23:02:12 +01:00
Tobias Nyholm
8668b4c222 Updated to use Assert 1.2 (#224) 2016-11-23 23:01:26 +01:00
Tobias Nyholm
9bd6732efd Introduce a request builder. (#217)
* Introduce a request builder.

We inject every dependency (eg RequestFactory and MultipartStreamBuilder) and we do not have to use postMultipart.

* code style

* Use uppercase on http verbs

* Added setters and use getters

* Added tests

* style
2016-11-23 21:55:05 +01:00
Sean Johnson
0da5f410a9 Rename serializer to deserializer (#201) (#216) 2016-11-12 02:50:47 +01:00
Tobias Nyholm
1a71c14097 Removed inheritence, Renamed classes, Mark all classes as final (#212)
* Removed inheritence, Renamed classes, Mark all classes as final

* code style

* Updated docs

* Code style

* Be consistant with the naming of functions

* Fixed tests
2016-11-11 14:53:26 -06:00
Sean Johnson
58430e4537 Domains API, #187 (#198) 2016-10-27 08:34:27 +02:00
Tobias Nyholm
738e6e32e2 POC - Better api (#192)
* Added base for the new API

* code style

* Added response classes

* Added support for serializer

* The abstract API should not know of Mailgun

* Minor

* minor

* Using a client configrator

* code style

* Put HTTPClient in the configurator

* Do not use the api() function

* Use stable version of Assert

* style

* Fixed tests

* make the httpClient private

* Renamed ResponseSerializer to ResponseDeserializer

* Disabled tests that are testing error messages with Assert

* style fixes

* Refactoring fix
2016-10-24 12:01:32 -05:00
Tobias Nyholm
043658f996 Added meta files (#195)
* Added meta files

* Style fixes from StyleCI
2016-10-14 19:20:46 -05:00
David Garcia
3aeb602406 Make sure $variables is an array in addRecipient() (#176)
* Write test to verify expected behaviour when we provide a String

* Fix broken test checking if the variable is an Array

* PSR Standard using single quote instead of double quote
2016-09-30 15:03:35 +02:00
David Garcia
6513c12d8c Applied fixes from StyleCI (#177) 2016-09-27 15:23:08 +02:00
Tobias Nyholm
8fe342f5b9 Apply fixes from StyleCI and make sure we add MIT license properly (#163)
* Applied fixes from StyleCI

* Create LICENSE
2016-09-18 09:56:14 +02:00
Wim Verstuyf
5d04bc63a7 Add attachment from memory (#158) 2016-09-06 13:05:50 +02:00
Tobias Nyholm
bf8d962739 Added more test cases 2016-08-10 18:28:19 +02:00
Tobias Nyholm
7119f18c26 Do not test same thing twice 2016-08-10 17:32:10 +02:00
Tobias Nyholm
741aa0d120 Make sure we use proper POST data arrays 2016-08-10 17:26:24 +02:00