public function testCreateFromFactory() { $transport = ServiceManagerFactory::getServiceManager()->get('EzMail\\Mail\\Transport\\PostageTransport'); $this->assertInstanceOf('EzMail\\Mail\\Transport\\HttpTransport', $transport); $property = new \ReflectionProperty('EzMail\\Mail\\Transport\\HttpTransport', 'service'); $property->setAccessible(true); $this->assertInstanceOf('EzMail\\Service\\PostageService', $property->getValue($transport)); }
public function testCanSetOptionsForHttpAdapter() { $serviceManager = ServiceManagerFactory::getServiceManager(); $serviceManager->setAllowOverride(true); $config = $serviceManager->get('Config'); $config['ez_mail']['http_options'] = array('sslverifypeer' => false); $serviceManager->setService('Config', $config); /** @var \Zend\Http\Client $client */ $client = $serviceManager->get('EzMail\\Http\\Client'); $config = $client->getAdapter()->getConfig(); $this->assertFalse($config['sslverifypeer']); }
public function testCreateFromFactory() { $serviceManager = ServiceManagerFactory::getServiceManager(); $serviceManager->setAllowOverride(true); $self = $this; $serviceManager->setFactory('Aws', function () use($self) { $aws = $self->getMock('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))); return $aws; }); $transport = $serviceManager->get('EzMail\\Mail\\Transport\\SesTransport'); $this->assertInstanceOf('EzMail\\Mail\\Transport\\HttpTransport', $transport); $property = new \ReflectionProperty('EzMail\\Mail\\Transport\\HttpTransport', 'service'); $property->setAccessible(true); $this->assertInstanceOf('EzMail\\Service\\SesService', $property->getValue($transport)); }
public function testCreateFromFactory() { $service = ServiceManagerFactory::getServiceManager()->get('EzMail\\Service\\MandrillService'); $this->assertInstanceOf('EzMail\\Service\\MandrillService', $service); }
<?php ini_set('error_reporting', E_ALL); $files = array(__DIR__ . '/../vendor/autoload.php', __DIR__ . '/../../../autoload.php'); foreach ($files as $file) { if (file_exists($file)) { $loader = (require $file); break; } } if (!isset($loader)) { throw new RuntimeException('vendor/autoload.php could not be found. Did you run `php composer.phar install`?'); } /* @var $loader \Composer\Autoload\ClassLoader */ $loader->add('EzMailTest\\', __DIR__); if (!($config = @(include __DIR__ . '/TestConfiguration.php'))) { $config = (require __DIR__ . '/TestConfiguration.php.dist'); } \EzMailTest\Util\ServiceManagerFactory::setConfig($config);