sterling                Fri Jan 16 15:50:31 2004 EDT

  Added files:                 
    /php-src/ext/simplexml/tests        profile01.phpt profile02.phpt 
                                        profile03.phpt profile04.phpt 
                                        profile05.phpt profile06.phpt 
                                        profile07.phpt profile08.phpt 
                                        profile09.phpt profile10.phpt 
                                        profile11.phpt 
  Log:
  Add a "profile" of simplexml's expected behaviour in the form of tests.  
  This will be expanded as issues arise and will be a formal definition 
  (in code) of simplexml's behaviour.
  
  

Index: php-src/ext/simplexml/tests/profile01.phpt
+++ php-src/ext/simplexml/tests/profile01.phpt
--TEST--
SimpleXML [profile]: Accessing a simple node
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php 
$root = simplexml_load_string('<?xml version="1.0"?>
<root>
 <child>Hello</child>
</root>
');

echo $root->child;
echo "\n---Done---\n";
?>
--EXPECT--
Hello
---Done--- 

Index: php-src/ext/simplexml/tests/profile02.phpt
+++ php-src/ext/simplexml/tests/profile02.phpt
--TEST--
SimpleXML [profile]: Accessing an array of subnodes
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php 
$root = simplexml_load_string('<?xml version="1.0"?>
<root>
 <child>Hello</child>
 <child>World</child>
</root>
');

foreach ($root->child as $child) {
        echo "$child ";
}
echo "\n---Done---\n";
?>
--EXPECT--
Hello World 
---Done--- 

Index: php-src/ext/simplexml/tests/profile03.phpt
+++ php-src/ext/simplexml/tests/profile03.phpt
--TEST--
SimpleXML [profile]: Accessing an attribute
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php 
$root = simplexml_load_string('<?xml version="1.0"?>
<root>
 <child attribute="Sample" />
</root>
');

echo $root->child['attribute'];
echo "\n---Done---\n";
?>
--EXPECT--
Sample
---Done--- 

Index: php-src/ext/simplexml/tests/profile04.phpt
+++ php-src/ext/simplexml/tests/profile04.phpt
--TEST--
SimpleXML [profile]: Accessing a namespaced element
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php 
$root = simplexml_load_string('<?xml version="1.0"?>
<root xmlns:reserved="reserved-ns">
 <reserved:child>Hello</reserved:child>
</root>
');

echo $root->reserved->child;
echo "\n---Done---\n";
?>
--EXPECT--
Hello
---Done--- 

Index: php-src/ext/simplexml/tests/profile05.phpt
+++ php-src/ext/simplexml/tests/profile05.phpt
--TEST--
SimpleXML [profile]: Accessing an aliased namespaced element
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
error_reporting(E_ALL & ~E_NOTICE);
$root = simplexml_load_string('<?xml version="1.0"?>
<root xmlns:reserved="reserved-ns">
 <reserved:child>Hello</reserved:child>
</root>
');

$root->register_ns('myns', 'reserved-ns');

echo $root->myns->child;
echo $root->reserved->child;
echo "\n---Done---\n";
?>
--EXPECT--
Hello
---Done--- 

Index: php-src/ext/simplexml/tests/profile06.phpt
+++ php-src/ext/simplexml/tests/profile06.phpt
--TEST--
SimpleXML [profile]: Accessing a namespaced attribute
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
error_reporting(E_ALL & ~E_NOTICE);
$root = simplexml_load_string('<?xml version="1.0"?>
<root xmlns:reserved="reserved-ns">
 <child reserved:attribute="Sample" />
</root>
');

echo $root->child['reserved:attribute'];
echo "\n---Done---\n";
?>
--EXPECT--
Sample
---Done--- 

Index: php-src/ext/simplexml/tests/profile07.phpt
+++ php-src/ext/simplexml/tests/profile07.phpt
--TEST--
SimpleXML [profile]: Accessing an aliased namespaced attribute
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
error_reporting(E_ALL & ~E_NOTICE);
$root = simplexml_load_string('<?xml version="1.0"?>
<root xmlns:reserved="reserved-ns">
 <child reserved:attribute="Sample" />
</root>
');

$root->register_ns('myns', 'reserved-ns');

echo $root->child['reserved:attribute'];
echo $root->child['myns:attribute'];
echo "\n---Done---\n";
?>
--EXPECT--
Sample
---Done--- 

Index: php-src/ext/simplexml/tests/profile08.phpt
+++ php-src/ext/simplexml/tests/profile08.phpt
--TEST--
SimpleXML [profile]: Accessing a namespaced attribute without a namespace
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
error_reporting(E_ALL & ~E_NOTICE);
$root = simplexml_load_string('<?xml version="1.0"?>
<root xmlns:reserved="reserved-ns">
 <child reserved:attribute="Sample" />
</root>
');

echo $root->child['attribute'];
echo "\n---Done---\n";
?>
--EXPECT--

---Done--- 

Index: php-src/ext/simplexml/tests/profile09.phpt
+++ php-src/ext/simplexml/tests/profile09.phpt
--TEST--
SimpleXML [profile]: Accessing a namespaced element without a namespace
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
error_reporting(E_ALL & ~E_NOTICE);
$root = simplexml_load_string('<?xml version="1.0"?>
<root xmlns:reserved="reserved-ns">
 <reserved:child>Hello</reserved:child>
</root>
');

echo $root->child;
echo "\n---Done---\n";
?>
--EXPECT--

---Done--- 

Index: php-src/ext/simplexml/tests/profile10.phpt
+++ php-src/ext/simplexml/tests/profile10.phpt
--TEST--
SimpleXML [profile]: Accessing two attributes with the same name, but different 
namespaces
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
error_reporting(E_ALL & ~E_NOTICE);
$root = simplexml_load_string('<?xml version="1.0"?>
<root xmlns:reserved="reserved-ns" xmlns:special="special-ns">
 <child reserved:attribute="Sample" special:attribute="Test" />
</root>
');

echo $root->child['reserved:attribute'];
echo "\n";
echo $root->child['special:attribute'];
foreach ($root->child['attribute'] as $attr) {
        echo "$attr\n";
}
echo "\n---Done---\n";
?>
--EXPECT--
Sample
Test
---Done--- 

Index: php-src/ext/simplexml/tests/profile11.phpt
+++ php-src/ext/simplexml/tests/profile11.phpt
--TEST--
SimpleXML [profile]: Accessing two elements with the same name, but different 
namespaces
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
error_reporting(E_ALL & ~E_NOTICE);
$root = simplexml_load_string('<?xml version="1.0"?>
<root xmlns:reserved="reserved-ns" xmlns:special="special-ns">
 <reserved:child>Hello</reserved:child>
 <special:child>World</special:child>
</root>
');

echo $root->reserved->child;
echo "\n";
echo $root->special->child;
foreach ($root->child as $child) {
        echo "$child\n";
}
echo "\n---Done---\n";
?>
--EXPECT--
Hello
World
---Done--- 

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to