예제 #1
0
 public function testStaticNodeChildrenTraversable()
 {
     $this->loadStaticXml();
     $expectedCount = 3;
     $traversable = 0;
     foreach ($this->xmlWithoutCache->getRoot() as $child) {
         $traversable++;
     }
     $this->assertEquals($traversable, $expectedCount);
     $traversable = 0;
     foreach ($this->xmlWithCache->getRoot() as $child) {
         $traversable++;
     }
     $this->assertEquals($traversable, $expectedCount);
 }
예제 #2
0
파일: playground.php 프로젝트: fewlines/xml
<?php

// Autoloader
require realpath(__DIR__ . '/../vendor/autoload.php');
// Uses
use Fewlines\XML\XML;
use Fewlines\XML\Element\Node;
/**
 * Fewlines XML tests
 */
$xml = new XML();
// $xml->load(__DIR__ . '/assets/xml-reader-test-valid.xml');
// $xml->getRoot()->append(
// 	new Node('testappend', [
// 		new Node('testnodechild'),
// 		new Node('testnodechild'),
// 		new Node('testnodechild'),
// 		new Node('testnodechild'),
// 		new Node('testnodechild'),
// 		new Node('testnodechild'),
// 		new Node('testnodechild')
// 	])
// );
$xml->load(__DIR__ . '/assets/xml-reader-test-ns.xml');
$xml->getRoot()->append(new Node('t:testappend', [new Node('t:testingchild', [], 'Content', ['t:prefixtrest' => 'prefixtest'])], '', ['xmlns:t' => 'http://Testing.de']));
$xml->save();
/**
 * SimpleXMLElement tests
 */
// $xml = new \SimpleXMLElement(__DIR__ . '/assets/xml-reader-test-valid.xml', 0, true);
// print_r($xml->xpath('testing/general'));
예제 #3
0
파일: WriterTest.php 프로젝트: fewlines/xml
 public function testValidExternFileSaveWithoutCache()
 {
     $this->xmlLoad('http://www.w3schools.com/xml/cd_catalog.xml');
     $this->xmlWithoutCache->save('tests/assets/xml-reader-test-save-extern.xml');
 }
예제 #4
0
파일: ReaderTest.php 프로젝트: fewlines/xml
 public function testWithCacheXML()
 {
     $this->assertTrue($this->xmlWithCache->hasCache());
 }