Example #1
0
 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();
 }
 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/');
 }