/**
  * @covers Jobs\Options\ProviderOptions::getChannels
  */
 public function testGetChannels()
 {
     $channel = new ChannelOptions();
     $channel->setKey('test')->setLabel('label');
     $this->options->addChannel($channel);
     $this->assertEquals(['test' => $channel], $this->options->getChannels());
 }
 /**
  * @testdox Allows creation of a multiposting select element
  */
 public function testCreateService()
 {
     $providerOptions = new ProviderOptions();
     $channelOptions = new ChannelOptions();
     $channelOptions->setCategory('testCat')->setCurrency('€')->setDescription('testDesc')->setExternalkey('testExtKey')->setHeadLine('testHL')->setKey('testKey')->setLabel('testLabel')->setLinkText('testLinkTxt')->setLogo('testLogo')->setParams(array('test' => 'params'))->setPrice('test', 1234)->setPublishDuration(10)->setRoute('testRoute')->setTax(19);
     $providerOptions->addChannel($channelOptions);
     $currencyFormat = $this->getMockBuilder('\\Zend\\I18n\\View\\Helper\\CurrencyFormat')->disableOriginalConstructor()->getMock();
     $currencyFormat->expects($this->any())->method('__invoke')->will($this->returnArgument(0));
     $helpers = $this->getMockBuilder('\\Zend\\ServiceManager\\AbstractPluginManager')->setMethods(array('get'))->getMockForAbstractClass();
     $helpers->expects($this->once())->method('get')->with('currencyFormat')->willReturn($currencyFormat);
     $router = $this->getMockBuilder('\\Zend\\Mvc\\Router\\SimpleRouteStack')->disableOriginalConstructor()->getMock();
     $router->expects($this->any())->method('assemble')->willReturn('/test/uri');
     $services = $this->getMockBuilder('\\Zend\\ServiceManager\\ServiceManager')->disableOriginalConstructor()->getMock();
     $servicesMap = array(array('Router', true, $router), array('ViewHelperManager', true, $helpers), array('Jobs/Options/Provider', true, $providerOptions));
     $services->expects($this->exactly(3))->method('get')->will($this->returnValueMap($servicesMap));
     $elements = $this->getMockBuilder('\\Zend\\ServiceManager\\AbstractPluginManager')->setMethods(array('getServiceLocator'))->getMockForAbstractClass();
     $elements->expects($this->once())->method('getServiceLocator')->willReturn($services);
     $target = new MultipostingSelectFactory();
     $select = $target->createService($elements);
     $this->assertInstanceOf('\\Jobs\\Form\\MultipostingSelect', $select);
     $this->assertEquals('false', $select->getAttribute('data-autoinit'));
     $this->assertEquals('multiple', $select->getAttribute('multiple'));
     $actual = $select->getValueOptions();
     $expected = array('testCat' => array('label' => 'testCat', 'options' => array('testKey' => 'testLabel|testHL|testDesc|testLinkTxt|/test/uri|10|testLogo')));
     $this->assertEquals($expected, $actual);
 }
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     $channel = new ChannelOptions();
     /* @var $core \Core\Options\ModuleOptions */
     $core = $serviceLocator->get("Core/Options");
     if ('' == $channel->getCurrency()) {
         $currency = $core->getDefaultCurrencyCode();
         $channel->setCurrency($currency);
     }
     if ('' == $channel->getTax()) {
         $channel->setTax($core->getDefaultTaxRate());
     }
     return $channel;
 }
 /**
  * @covers Jobs\Options\ChannelOptions::getLogo
  * @covers Jobs\Options\ChannelOptions::setLogo
  */
 public function testSetGetLogo()
 {
     $input = "test.logo.gif";
     $this->options->setLogo($input);
     $this->assertEquals($input, $this->options->getLogo());
 }
Example #5
0
 /**
  * Adds a channel (aka job portal)
  *
  * @param ChannelOptions $channel
  * @return $this
  */
 public function addChannel(ChannelOptions $channel)
 {
     $key = $channel->getKey();
     $this->channels[$key] = $channel;
     return $this;
 }