Esempio n. 1
0
 public function testTreeXmlToMemory()
 {
     $treeFrom = ezcTreeXml::create($this->tempDir . 'testTreeMemoryToXML.xml', $this->storeFromXml);
     $this->addTestData($treeFrom);
     $treeTo = ezcTreeMemory::create($this->storeToMem);
     self::doCopyTest($treeFrom, $treeTo);
 }
Esempio n. 2
0
 public function testTreeParentChildToXML()
 {
     $treeFrom = new ezcTreeDbParentChild($this->dbh, 'parent_child', $this->storeFrom);
     $this->addTestData($treeFrom);
     $treeTo = ezcTreeXml::create($this->tempDir . 'testTreeParentChildToXML.xml', $this->storeToXml);
     self::doCopyTest($treeFrom, $treeTo);
 }
Esempio n. 3
0
 public function testTreeDbStorage()
 {
     $tree = ezcTreeXml::create($this->tempDir . 'testDbStorage.xml', $this->store);
     $this->addTestData($tree);
     self::assertSame("Western Hoolock Gibbon", $tree->fetchNodeById("Western_Hoolock_Gibbon")->data);
     // start over
     $tree = new ezcTreeXml($this->tempDir . 'testDbStorage.xml', $this->store);
     self::assertSame("Western Hoolock Gibbon", $tree->fetchNodeById("Western_Hoolock_Gibbon")->data);
 }
Esempio n. 4
0
 public function testFetchDataXmlTree()
 {
     $store = new ezcTreePersistentObjectDataStore($this->session, 'FileEntry', 'id');
     $tree = ezcTreeXml::create($this->tempDir . 'test-xml.xml', $store, 'ezc');
     $this->emptyTables();
     $this->addStandardData($tree);
     // start over
     $tree = new ezcTreeXml($this->tempDir . 'test-xml.xml', $store, 'ezc');
     $node = $tree->fetchNodeById('3');
     self::assertSame(3, (int) $node->data->id);
     self::assertSame(FileEntry::PARTITION, (int) $node->data->type);
     $node = $tree->fetchNodeById('grubby');
     self::assertSame('grubby', $node->data->id);
     self::assertSame(172, (int) $node->data->size);
 }
Esempio n. 5
0
<?php

require_once 'tutorial_autoload.php';
$store = new ezcTreeXmlInternalDataStore();
$tree = ezcTreeXml::create('files/example1.xml', $store);
$rootNode = $tree->createNode('Elements', 'Elements');
$tree->setRootNode($rootNode);
$nonMetal = $tree->createNode('NonMetals', 'Non-Metals');
$rootNode->addChild($nonMetal);
$nobleGasses = $tree->createNode('NobleGasses', 'Noble Gasses');
$rootNode->addChild($nobleGasses);
$nonMetal->addChild($tree->createNode('H', 'Hydrogen'));
$nonMetal->addChild($tree->createNode('C', 'Carbon'));
$nonMetal->addChild($tree->createNode('N', 'Nitrogen'));
$nonMetal->addChild($tree->createNode('O', 'Oxygen'));
$nonMetal->addChild($tree->createNode('P', 'Phosphorus'));
$nonMetal->addChild($tree->createNode('S', 'Sulfur'));
$nonMetal->addChild($tree->createNode('Se', 'Selenium'));
$nobleGasses->addChild($tree->createNode('F', 'Fluorine'));
$nobleGasses->addChild($tree->createNode('Cl', 'Chlorine'));
$nobleGasses->addChild($tree->createNode('Br', 'Bromine'));
$nobleGasses->addChild($tree->createNode('I', 'Iodine'));
Esempio n. 6
0
 public function testReloadAutoGenIdWithPrefix()
 {
     $tree = ezcTreeXml::create($this->tempDir . '/new-tree.xml', new ezcTreeXmlInternalDataStore(), 'ezc');
     $tree->autoId = true;
     $root = $tree->createNode(null, "Camelinae");
     $tree->setRootNode($root);
     $root->addChild($tree->createNode(null, "Lama"));
     $root->addChild($tree->createNode(null, "Vicugna"));
     $root->addChild($tree->createNode(null, "Camelus"));
     // start over
     $tree = new ezcTreeXml($this->tempDir . '/new-tree.xml', new ezcTreeXmlInternalDataStore());
     $root = $tree->getRootNode();
     $newNode = $tree->createNode(null, "Oempa");
     $root->addChild($newNode);
     $camelus = $tree->fetchNodeById(5);
     self::assertSame("Oempa", $camelus->data);
     // start over
     $tree = new ezcTreeXml($this->tempDir . '/new-tree.xml', new ezcTreeXmlInternalDataStore());
     $root = $tree->fetchNodeById(5);
     $newNode = $tree->createNode(null, "Loempa");
     $root->addChild($newNode);
     $camelus = $tree->fetchNodeById(5);
     self::assertSame("Oempa", $camelus->data);
     $camelus = $tree->fetchNodeById(6);
     self::assertSame("Loempa", $camelus->data);
 }