Skip to content

Commit

Permalink
Merge pull request #105 from jackdpeterson/master
Browse files Browse the repository at this point in the history
AWS Sdk for PHP v3 support
  • Loading branch information
bakura10 committed Jul 7, 2016
2 parents caa6d4d + bebe45c commit e63377c
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 39 deletions.
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
language: php

php:
- 5.3
- 5.4
- 5.6
- 7.0

cache:
directories:
- $HOME/.composer/cache

before_script:
- composer install --dev --prefer-source
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# CHANGELOG
## 2.0.0
- bump to aws-sdk-for-php ZF2 module to 2.*
-- which in turn bumps support to AWS SDK for PHP v3


## 1.6.0

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Here are the currently supported services:
Requirements
------------

* PHP 5.3
* PHP 5.6
* [Zend Framework 2](https://github.com/zendframework/zf2)
* [Amazon AWS ZF 2 Module](https://github.com/aws/aws-sdk-php-zf2): only if you plan to use Amazon SES service

Expand All @@ -49,7 +49,7 @@ file called `composer.json` and save it in the root of your project:
```
{
"require": {
"slm/mail": "~1.6"
"slm/mail": "~2.0"
}
}
```
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
}
],
"require": {
"php": ">=5.3.3",
"php": ">=5.6",
"zendframework/zend-mail": "~2.0",
"zendframework/zend-http": "~2.0"
},
"require-dev": {
"aws/aws-sdk-php-zf2": ">=1.0.1",
"aws/aws-sdk-php-zf2": "~2.0",
"zendframework/zendframework": "~2.0"
},
"suggest": {
Expand Down
3 changes: 2 additions & 1 deletion src/SlmMail/Factory/SesServiceFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
use SlmMail\Service\SesService;
use Zend\ServiceManager\FactoryInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Aws\Sdk;

class SesServiceFactory implements FactoryInterface
{
Expand All @@ -51,6 +52,6 @@ class SesServiceFactory implements FactoryInterface
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
return new SesService($serviceLocator->get('Aws')->get('Ses'));
return new SesService($serviceLocator->get(Sdk::class)->createSes());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testCreateFromFactory()

public function testTransportUsesElasticEmailService()
{
$service = $this->getMock('SlmMail\Service\ElasticEmailService', array(), array('my-username', 'my-secret-key'));
$service = $this->createMock('SlmMail\Service\ElasticEmailService', array(), array('my-username', 'my-secret-key'));
$transport = new HttpTransport($service);
$message = new Message();

Expand Down
2 changes: 1 addition & 1 deletion tests/SlmMailTest/Mail/Transport/MailgunTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testCreateFromFactory()

public function testTransportUsesMailgunService()
{
$service = $this->getMock('SlmMail\Service\MailgunService', array(), array('my-domain', 'my-secret-key'));
$service = $this->createMock('SlmMail\Service\MailgunService', array(), array('my-domain', 'my-secret-key'));
$transport = new HttpTransport($service);
$message = new Message();

Expand Down
2 changes: 1 addition & 1 deletion tests/SlmMailTest/Mail/Transport/MandrillTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testCreateFromFactory()

public function testTransportUsesMandrillService()
{
$service = $this->getMock('SlmMail\Service\MandrillService', array(), array('my-secret-key'));
$service = $this->createMock('SlmMail\Service\MandrillService', array(), array('my-secret-key'));
$transport = new HttpTransport($service);
$message = new Message();

Expand Down
2 changes: 1 addition & 1 deletion tests/SlmMailTest/Mail/Transport/PostageTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testCreateFromFactory()

public function testTransportUsesPostageService()
{
$service = $this->getMock('SlmMail\Service\PostageService', array(), array('my-secret-key'));
$service = $this->createMock('SlmMail\Service\PostageService', array(), array('my-secret-key'));
$transport = new HttpTransport($service);
$message = new Message();

Expand Down
2 changes: 1 addition & 1 deletion tests/SlmMailTest/Mail/Transport/PostmarkTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testCreateFromFactory()

public function testTransportUsesPostmarkService()
{
$service = $this->getMock('SlmMail\Service\PostmarkService', array(), array('my-secret-key'));
$service = $this->createMock('SlmMail\Service\PostmarkService', array(), array('my-secret-key'));
$transport = new HttpTransport($service);
$message = new Message();

Expand Down
2 changes: 1 addition & 1 deletion tests/SlmMailTest/Mail/Transport/SendGridTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public function testCreateFromFactory()

public function testTransportUsesSendGridService()
{
$service = $this->getMock('SlmMail\Service\SendGridService', array(), array('my-username', 'my-secret-key'));
$service = $this->createMock('SlmMail\Service\SendGridService', array(), array('my-username', 'my-secret-key'));
$transport = new HttpTransport($service);
$message = new Message();

Expand Down
13 changes: 6 additions & 7 deletions tests/SlmMailTest/Mail/Transport/SesTransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,11 @@ public function testCreateFromFactory()
$serviceManager->setAllowOverride(true);

$self = $this;
$serviceManager->setFactory('Aws', function() use ($self) {
$aws = $self->getMock('Guzzle\Service\Builder\ServiceBuilderInterface');
$serviceManager->setFactory('AwsModule', function() use ($self) {
$aws = $self->createMock('Guzzle\Service\Builder\ServiceBuilderInterface');
$aws->expects($self->once())
->method('get')
->with($self->equalTo('Ses'))
->will($self->returnValue($self->getMock('Aws\Ses\SesClient', array(), array(), '', false)));
->method('createSes')
->will($self->returnValue($self->createMock('Aws\Ses\SesClient', array(), array(), '', false)));

return $aws;
});
Expand All @@ -74,8 +73,8 @@ public function testCreateFromFactory()

public function testTransportUsesSesService()
{
$client = $this->getMock('Aws\Ses\SesClient', array(), array(), '', false);
$service = $this->getMock('SlmMail\Service\SesService', array(), array($client));
$client = $this->createMock('Aws\Ses\SesClient', array(), array(), '', false);
$service = $this->createMock('SlmMail\Service\SesService', array(), array($client));
$transport = new HttpTransport($service);
$message = new Message();

Expand Down
2 changes: 1 addition & 1 deletion tests/SlmMailTest/Util/ServiceManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static function getServiceManager()
isset(static::$config['service_manager']) ? static::$config['service_manager'] : array()
));
$serviceManager->setService('ApplicationConfig', static::$config);
$serviceManager->setFactory('ServiceListener', 'Zend\Mvc\Service\ServiceListenerFactory');
//$serviceManager->setFactory('ServiceListener', 'Zend\Mvc\Service\ServiceListenerFactory');

/** @var $moduleManager \Zend\ModuleManager\ModuleManager */
$moduleManager = $serviceManager->get('ModuleManager');
Expand Down
2 changes: 1 addition & 1 deletion tests/TestConfiguration.php.dist
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
return array(
'modules' => array(
'Aws',
'AwsModule',
'SlmMail',
),
'module_listener_options' => array(
Expand Down
28 changes: 11 additions & 17 deletions tests/testing.config.php
Original file line number Diff line number Diff line change
@@ -1,42 +1,36 @@
<?php

return array(
'slm_mail' => array(
'elastic_email' => array(
'username' => 'my-username',
'key' => 'my-secret-key'
'key' => 'my-secret-key'
),

'mandrill' => array(
'key' => 'my-secret-key'
),

'postage' => array(
'key' => 'my-secret-key'
),

'postmark' => array(
'key' => 'my-secret-key'
),

'mailgun' => array(
'domain' => 'my-domain',
'key' => 'my-key'
'key' => 'my-key'
),

'send_grid' => array(
'username' => 'my-username',
'key' => 'my-key'
'key' => 'my-key'
)
),

'aws' => array(
'services' => array(
'ses' => array(
'params' => array(
'region' => 'us-east-1'
)
)
)
'region' => 'us-east-1',
'version' => 'latest'
)
);

0 comments on commit e63377c

Please sign in to comment.