public function setUp() { $resultSet = new \Zend\Db\ResultSet\ResultSet(); $resultSet->initialize(array(array('Name' => 'RegValue'))); $this->_registryManager = $this->createMock('Model\\Registry\\RegistryManager'); $this->_registryManager->expects($this->once())->method('getValueDefinitions')->willReturn($resultSet); $this->_customFieldManager = $this->createMock('Model\\Client\\CustomFieldManager'); $this->_customFieldManager->expects($this->once())->method('getFields')->will($this->returnValue(array('TAG' => 'text', 'Clob' => 'clob', 'Integer' => 'integer', 'Float' => 'float', 'Date' => 'date'))); parent::setUp(); }
/** * Set up Config mock object */ public function setUp() { $this->_config = $this->getMockBuilder('Model\\Config')->disableOriginalconstructor()->getMock(); $this->_config->expects($this->any())->method('__get')->with('inspectRegistry')->willReturn(1); $resultSet = new \Zend\Db\ResultSet\ResultSet(); $resultSet->initialize($this->_values); $this->_registryManager = $this->getMockBuilder('Model\\Registry\\RegistryManager')->disableOriginalconstructor()->getMock(); $this->_registryManager->expects($this->once())->method('getValueDefinitions')->willReturn($resultSet); parent::setUp(); }
/** * Information about a client's registry values (Windows only) * * @return array client, values, order, direction */ public function registryAction() { $values = array(); foreach ($this->_registryManager->getValueDefinitions() as $value) { $values[$value['Name']] = $value; } return $this->getOrder('Value') + array('client' => $this->_currentClient, 'values' => $values); }
/** * Delete a registry value definition * * URL parameter: name * * @return array|\Zend\Http\Response Array(name) or redirect response */ public function deleteregistryvalueAction() { if ($this->getRequest()->isPost()) { if ($this->params()->fromPost('yes')) { $this->_registryManager->deleteValueDefinition($this->params()->fromQuery('name')); } return $this->redirectToRoute('preferences', 'registryvalues'); } else { return array('name' => $this->params()->fromQuery('name')); } }
public function testRegistryActionWithValues() { $data = array('Value' => '<value>', 'Data' => 'data'); $values = array(array('Name' => 'unused', 'FullPath' => null), array('Name' => '<value>', 'FullPath' => 'full_path')); $client = $this->createMock('Model\\Client\\Client'); $client->expects($this->once())->method('getItems')->with('RegistryData', 'Value', 'asc')->willReturn(array($data)); $this->_clientManager->method('getClient')->willReturn($client); $this->_registryManager->expects($this->once())->method('getValueDefinitions')->willReturn($values); $this->dispatch('/console/client/registry/?id=1'); $this->assertResponseStatusCode(200); $this->assertXpathQueryContentContains('//tr[2]/td[1]/span[@title="full_path"]', "\n<value>\n"); $this->assertXpathQueryContentContains('//tr[2]/td[2]', "\ndata\n"); $this->assertXpathQuery('//p/a[@href="/console/preferences/registryvalues/"]'); }
public function testRenderNoExistingValues() { $this->_registryManager = $this->createMock('Model\\Registry\\RegistryManager'); $this->_registryManager->expects($this->once())->method('getValueDefinitions')->willReturn(new \ArrayIterator()); $document = new \Zend\Dom\Document($this->_getForm()->render($this->_createView())); $result = Query::execute("//h2[text()='\nWerte\n']", $document); $this->assertCount(0, $result); $result = Query::execute('//tr', $document); $this->assertCount(0, $result); // Other fieldsets must exist $result = Query::execute('//input[@name="inspect[inspect]"][@type="checkbox"]', $document); $this->assertCount(1, $result); $result = Query::execute('//input[@name="new_value[name]"]', $document); $this->assertCount(1, $result); }
public function testDeleteregistryvalueActionPostYes() { $this->_registryManager->expects($this->once())->method('deleteValueDefinition')->with('value_name'); $this->dispatch('/console/preferences/deleteregistryvalue/?name=value_name', 'POST', array('yes' => 'Yes')); $this->assertRedirectTo('/console/preferences/registryvalues/'); }