public function testCreateServiceWithDirectoryCreation() { $configArray = array('transport_class' => 'Zend\\Mail\\Transport\\File', 'transport_options' => array('path' => vfsStream::url('exampleDir') . '/tmp')); $config = new ModuleOptions($configArray); $this->serviceManager->setService('EscoMail\\Options', $config); $factory = new TransportFactory(); $transport = $factory->createService($this->serviceManager); $this->assertInstanceOf('Zend\\Mail\\Transport\\File', $transport); $this->assertTrue($this->root->hasChild('tmp')); }
/** * @covers EscoMail\Service\MailServiceFactory::getTransport */ public function testGetTransport() { vfsStream::setup('exampleDir', 0777); $configArray = array('transport_class' => 'Zend\\Mail\\Transport\\File', 'transport_options' => array('path' => vfsStream::url('exampleDir') . '/data/mail')); $options = new ModuleOptions($configArray); $serviceManager = new ServiceManager(); $serviceManager->setService('EscoMail\\Options', $options); $transportFactory = new TransportFactory(); $transport = $transportFactory->createService($serviceManager); $serviceManager->setService('EscoMail\\Transport', $transport); $factory = new MailServiceFactory(); $mailService = $factory->createService($serviceManager); $this->assertInstanceOf('Zend\\Mail\\Transport\\TransportInterface', $mailService->getTransport()); }