コード例 #1
0
 public function testIndexActionManualKeys()
 {
     $this->_softwareManager->expects($this->once())->method('getNumManualProductKeys')->willReturn(1);
     $this->dispatch('/console/licenses/index/');
     $this->assertResponseStatusCode(200);
     $this->assertXPathQueryContentContains('//p/a[@href="/console/client/index/?' . 'columns=Name,OsName,Windows.ProductKey,Windows.ManualProductKey&' . 'filter=Windows.ManualProductKey&order=Name&direction=asc"]', "\n1\n");
 }
コード例 #2
0
 public function testIndexActionManualKeys()
 {
     // Nonzero manual product keys produce <dd><a...>n</a></dd>.
     $this->_softwareManager = $this->getMockBuilder('Model\\SoftwareManager')->disableOriginalConstructor()->getMock();
     $this->_softwareManager->expects($this->once())->method('getNumManualProductKeys')->willReturn(1);
     $this->dispatch('/console/licenses/index/');
     $this->assertResponseStatusCode(200);
     $this->assertXPathQueryContentContains('//dd/a[@href="/console/client/index/?' . 'columns=Name,OsName,Windows.ProductKey,Windows.ManualProductKey&' . 'filter=Windows.ManualProductKey&order=Name&direction=asc"]', "\n1\n");
 }
コード例 #3
0
 protected function _testManageActionPostYes($action, $display)
 {
     $tmBad = chr(0xc2) . chr(0x99);
     // Incorrect representation of TM symbol
     $this->_softwareManager->expects($this->once())->method('setDisplay')->with($tmBad, $display);
     $session = new \Zend\Session\Container('ManageSoftware');
     $session->filter = 'test';
     $this->dispatch("/console/software/{$action}/?name={$tmBad}", 'POST', array('yes' => 'Yes'));
     $this->assertRedirectTo('/console/software/index/?filter=test');
 }
コード例 #4
0
 public function testWindowsActionPostValid()
 {
     $postData = array('Key' => 'entered_key');
     $form = $this->getApplicationServiceLocator()->get('FormElementManager')->get('Console\\Form\\ProductKey');
     $form->expects($this->once())->method('setData')->with($postData);
     $form->expects($this->once())->method('isValid')->will($this->returnValue(true));
     $form->expects($this->once())->method('getData')->will($this->returnValue($postData));
     $map = array(array('Id', 1));
     $client = $this->createMock('Model\\Client\\Client');
     $client->method('offsetGet')->will($this->returnValueMap($map));
     $this->_clientManager->method('getClient')->willReturn($client);
     $this->_softwareManager->expects($this->once())->method('setProductKey')->with($client, 'entered_key');
     $this->dispatch('/console/client/windows/?id=1', 'POST', $postData);
     $this->assertRedirectTo('/console/client/windows/?id=1');
 }