/** * @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); }
/** * @covers Jobs\Options\ChannelOptions::getCategory * @covers Jobs\Options\ChannelOptions::setCategory */ public function testSetGetCategory() { $category = "Technical Jobs"; $this->options->setCategory($category); $this->assertEquals($category, $this->options->getCategory()); }