/**
  * @return array
  */
 protected function getChoices()
 {
     $transports = $this->emailTransportProvider->getTransports();
     $choices = array();
     foreach ($transports as $transport) {
         $choices[$transport->getName()] = $transport->getLabel();
     }
     return $choices;
 }
 public function testProviderMethods()
 {
     $provider = new EmailTransportProvider();
     $name = 'test';
     $transport = $this->getMock('OroCRM\\Bundle\\CampaignBundle\\Transport\\TransportInterface');
     $transport->expects($this->once())->method('getName')->will($this->returnValue($name));
     $this->assertEmpty($provider->getTransports());
     $this->assertFalse($provider->hasTransport($name));
     $provider->addTransport($transport);
     $this->assertTrue($provider->hasTransport($name));
     $this->assertCount(1, $provider->getTransports());
     $this->assertEquals($transport, $provider->getTransportByName($name));
 }
 /**
  * @param string $selectedTransportName
  * @return TransportInterface
  */
 protected function getSelectedTransport($selectedTransportName)
 {
     if ($selectedTransportName) {
         $selectedTransport = $this->emailTransportProvider->getTransportByName($selectedTransportName);
     } else {
         $transportChoices = $this->emailTransportProvider->getTransports();
         $selectedTransport = reset($transportChoices);
     }
     return $selectedTransport;
 }