Skip to content

Commit

Permalink
Adds files: error 1 to 5 and variation 1 to 4
Browse files Browse the repository at this point in the history
tests for error1: not well formed xml

tests for error2: not well formed xml attribute without colon

tests for error2: not well formed xml, typo

tests for error4: wrong xml version

tests for error5: extra content at the end of the doc

tests libxml_dtd_load

tests libxml_dtd_valid

tests for libdtd_noerror

tests for LIBXML_DTDATTR, LIBXML_NOCDATA, LIBXML_NOENT and LIBXML_NOBLANKS

the basic behavior

fix comments
  • Loading branch information
dejalatele authored and smalyshev committed Aug 11, 2013
1 parent 473d665 commit 24f3693
Show file tree
Hide file tree
Showing 33 changed files with 628 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ext/dom/tests/DOMDocument_loadXML_basic.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
Test DOMDocument::loadXML() basic behavior
--DESCRIPTION--
This test verifies the basic behaviour of the method
Environment variables used in the test:
- XML_FILE: the xml file to load
- LOAD_OPTIONS: the second parameter to pass to the method
- EXPECTED_RESULT: the expected result
--CREDITS--
Antonio Diaz Ruiz <[email protected]>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--ENV--
XML_FILE=/book.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=1
--FILE_EXTERNAL--
domdocumentloadxml_test_method.php
--EXPECT--
26 changes: 26 additions & 0 deletions ext/dom/tests/DOMDocument_loadXML_error1.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--TEST--
Test DOMDocument::loadXML() detects not-well formed XML
--DESCRIPTION--
This test verifies the method detects an opening and ending tag mismatch
Environment variables used in the test:
- XML_FILE: the xml file to load
- LOAD_OPTIONS: the second parameter to pass to the method
- EXPECTED_RESULT: the expected result
--CREDITS--
Antonio Diaz Ruiz <[email protected]>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--ENV--
XML_FILE=/not_well_formed.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
domdocumentloadxml_test_method.php
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: title line 5 and book %s

Warning: DOMDocument::load%r(XML){0,1}%r(): expected '>' %s

Warning: DOMDocument::load%r(XML){0,1}%r(): Premature end of data in tag books %s
30 changes: 30 additions & 0 deletions ext/dom/tests/DOMDocument_loadXML_error2.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
--TEST--
Test DOMDocument::loadXML() detects not-well formed XML
--DESCRIPTION--
This test verifies the method detects attributes values not closed between " or '
Environment variables used in the test:
- XML_FILE: the xml file to load
- LOAD_OPTIONS: the second parameter to pass to the method
- EXPECTED_RESULT: the expected result
--CREDITS--
Antonio Diaz Ruiz <[email protected]>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--ENV--
XML_FILE=/not_well_formed2.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
domdocumentloadxml_test_method.php
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): AttValue: " or ' expected %s

Warning: DOMDocument::load%r(XML){0,1}%r(): attributes construct error %s

Warning: DOMDocument::load%r(XML){0,1}%r(): Couldn't find end of Start Tag book %s

Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: books %s

Warning: DOMDocument::load%r(XML){0,1}%r(): Extra content at the end of the document %s
22 changes: 22 additions & 0 deletions ext/dom/tests/DOMDocument_loadXML_error3.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
Test DOMDocument::loadXML() detects not-well formed XML
--DESCRIPTION--
This test verifies the method detects a typo in tag names
Environment variables used in the test:
- XML_FILE: the xml file to load
- LOAD_OPTIONS: the second parameter to pass to the method
- EXPECTED_RESULT: the expected result
--CREDITS--
Antonio Diaz Ruiz <[email protected]>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--ENV--
XML_FILE=/not_well_formed3.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
domdocumentloadxml_test_method.php
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: boOk line 8 and book %s
22 changes: 22 additions & 0 deletions ext/dom/tests/DOMDocument_loadXML_error4.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
Test DOMDocument::loadXML() detects not-well formed XML
--DESCRIPTION--
This test verifies the method detects an unsupported xml version
Environment variables used in the test:
- XML_FILE: the xml file to load
- LOAD_OPTIONS: the second parameter to pass to the method
- EXPECTED_RESULT: the expected result
--CREDITS--
Antonio Diaz Ruiz <[email protected]>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--ENV--
XML_FILE=/not_well_formed4.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
domdocumentloadxml_test_method.php
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Unsupported version '3.1' %s
22 changes: 22 additions & 0 deletions ext/dom/tests/DOMDocument_loadXML_error5.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
Test DOMDocument::loadXML() detects not-well formed XML
--DESCRIPTION--
This test verifies the method detects extra content at the end of the document
Environment variables used in the test:
- XML_FILE: the xml file to load
- LOAD_OPTIONS: the second parameter to pass to the method
- EXPECTED_RESULT: the expected result
--CREDITS--
Antonio Diaz Ruiz <[email protected]>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--ENV--
XML_FILE=/not_well_formed5.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
domdocumentloadxml_test_method.php
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Extra content at the end of the document %s
21 changes: 21 additions & 0 deletions ext/dom/tests/DOMDocument_loadXML_variation1.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
Test DOMDocument::loadXML() with LIBXML_DTDLOAD option
--DESCRIPTION--
This test verifies the right behaviour of the LIBXML_DTDLOAD constant
Environment variables used in the test:
- XML_FILE: the xml file to load
- LOAD_OPTIONS: the second parameter to pass to the method
- EXPECTED_RESULT: the expected result
--CREDITS--
Antonio Diaz Ruiz <[email protected]>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--ENV--
XML_FILE=/book_with_dtd.xml
LOAD_OPTIONS=LIBXML_DTDLOAD
EXPECTED_RESULT=1
--FILE_EXTERNAL--
domdocumentloadxml_test_method.php
--EXPECT--
22 changes: 22 additions & 0 deletions ext/dom/tests/DOMDocument_loadXML_variation2.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
Test DOMDocument::loadXML() with LIBXML_DTDVALID option
--DESCRIPTION--
This test verifies the right behaviour of the LIBXML_DTDVALID constant
Environment variables used in the test:
- XML_FILE: the xml file to load
- LOAD_OPTIONS: the second parameter to pass to the method
- EXPECTED_RESULT: the expected result
--CREDITS--
Antonio Diaz Ruiz <[email protected]>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--ENV--
XML_FILE=/wrong_book_with_dtd.xml
LOAD_OPTIONS=LIBXML_DTDVALID
EXPECTED_RESULT=1
--FILE_EXTERNAL--
domdocumentloadxml_test_method.php
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Element book content does not follow the DTD, expecting (title , author), got (title author author ) %s
22 changes: 22 additions & 0 deletions ext/dom/tests/DOMDocument_loadXML_variation3.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
Test DOMDocument::loadXML() with LIBXML_DTDVALID and LIBXML_NOERROR options
--DESCRIPTION--
This test vrifies the right behaviour of the LIBXML_NOERROR constant
which avoids the display of the warning message
Environment variables used in the test:
- XML_FILE: the xml file to load
- LOAD_OPTIONS: the second parameter to pass to the method
- EXPECTED_RESULT: the expected result
--CREDITS--
Antonio Diaz Ruiz <[email protected]>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--ENV--
XML_FILE=/wrong_book_with_dtd.xml
LOAD_OPTIONS=LIBXML_DTDVALID | LIBXML_NOERROR
EXPECTED_RESULT=1
--FILE_EXTERNAL--
domdocumentloadxml_test_method.php
--EXPECT--
25 changes: 25 additions & 0 deletions ext/dom/tests/DOMDocument_loadXML_variation4.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
--TEST--
Test DOMDocument::loadXML() with LIBXML_DTDATTR, LIBXML_NOCDATA, LIBXML_NOENT, LIBXML_NOBLANKS
--DESCRIPTION--
This test verifies the right behaviour of the following constants:
LIBXML_DTDATTR, LIBXML_NOCDATA, LIBXML_NOENT and LIBXML_NOBLANKS
Environment variables used in the test:
- XML_FILE: the xml file to load
- LOAD_OPTIONS: the second parameter to pass to the method
- EXPECTED_RESULT: the expected result
--CREDITS--
Antonio Diaz Ruiz <[email protected]>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--ENV--
XML_FILE=/book_with_dtd.xml
LOAD_OPTIONS=LIBXML_DTDATTR|LIBXML_NOCDATA|LIBXML_NOENT|LIBXML_NOBLANKS
EXPECTED_RESULT=1
--FILE_EXTERNAL--
domdocumentloadxml_test_method_savexml.php
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE books SYSTEM "books.dtd">
<books><book><title default="default title">The Grapes of Wrath</title><author>John Steinbeck</author></book><book><title default="default title">The Pearl</title><author>John Steinbeck</author></book><book><title default="default title">entity is only for test purposes</title><author>data for test</author></book></books>
21 changes: 21 additions & 0 deletions ext/dom/tests/DOMDocument_load_basic.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
--TEST--
Test DOMDocument::load() basic behavior
--DESCRIPTION--
This test verifies the basic behaviour of the method
Environment variables used in the test:
- XML_FILE: the xml file to load
- LOAD_OPTIONS: the second parameter to pass to the method
- EXPECTED_RESULT: the expected result
--CREDITS--
Antonio Diaz Ruiz <[email protected]>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--ENV--
XML_FILE=/book.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=1
--FILE_EXTERNAL--
domdocumentload_test_method.php
--EXPECT--
26 changes: 26 additions & 0 deletions ext/dom/tests/DOMDocument_load_error1.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
--TEST--
Test DOMDocument::load() detects not-well formed XML
--DESCRIPTION--
This test verifies the method detects an opening and ending tag mismatch
Environment variables used in the test:
- XML_FILE: the xml file to load
- LOAD_OPTIONS: the second parameter to pass to the method
- EXPECTED_RESULT: the expected result
--CREDITS--
Antonio Diaz Ruiz <[email protected]>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--ENV--
XML_FILE=/not_well_formed.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
domdocumentload_test_method.php
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: title line 5 and book %s

Warning: DOMDocument::load%r(XML){0,1}%r(): expected '>' %s

Warning: DOMDocument::load%r(XML){0,1}%r(): Premature end of data in tag books %s
30 changes: 30 additions & 0 deletions ext/dom/tests/DOMDocument_load_error2.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
--TEST--
Test DOMDocument::load() detects not-well formed XML
--DESCRIPTION--
This test verifies the method detects attributes values not closed between " or '
Environment variables used in the test:
- XML_FILE: the xml file to load
- LOAD_OPTIONS: the second parameter to pass to the method
- EXPECTED_RESULT: the expected result
--CREDITS--
Antonio Diaz Ruiz <[email protected]>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--ENV--
XML_FILE=/not_well_formed2.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
domdocumentload_test_method.php
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): AttValue: " or ' expected %s

Warning: DOMDocument::load%r(XML){0,1}%r(): attributes construct error %s

Warning: DOMDocument::load%r(XML){0,1}%r(): Couldn't find end of Start Tag book %s

Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: books %s

Warning: DOMDocument::load%r(XML){0,1}%r(): Extra content at the end of the document %s
22 changes: 22 additions & 0 deletions ext/dom/tests/DOMDocument_load_error3.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
Test DOMDocument::load() detects not-well formed XML
--DESCRIPTION--
This test verifies the method detects and opening and ending tag mismatch
Environment variables used in the test:
- XML_FILE: the xml file to load
- LOAD_OPTIONS: the second parameter to pass to the method
- EXPECTED_RESULT: the expected result
--CREDITS--
Antonio Diaz Ruiz <[email protected]>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--ENV--
XML_FILE=/not_well_formed3.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
domdocumentload_test_method.php
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Opening and ending tag mismatch: boOk line 8 and book %s
22 changes: 22 additions & 0 deletions ext/dom/tests/DOMDocument_load_error4.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
Test DOMDocument::load() detects not-well formed XML
--DESCRIPTION--
This test verifies the method detects an unsupported xml version
Environment variables used in the test:
- XML_FILE: the xml file to load
- LOAD_OPTIONS: the second parameter to pass to the method
- EXPECTED_RESULT: the expected result
--CREDITS--
Antonio Diaz Ruiz <[email protected]>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--ENV--
XML_FILE=/not_well_formed4.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
domdocumentload_test_method.php
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Unsupported version '3.1' %s
22 changes: 22 additions & 0 deletions ext/dom/tests/DOMDocument_load_error5.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
--TEST--
Test DOMDocument::load() detects not-well formed XML
--DESCRIPTION--
This test verifies the method detects extra content at the end of the document
Environment variables used in the test:
- XML_FILE: the xml file to load
- LOAD_OPTIONS: the second parameter to pass to the method
- EXPECTED_RESULT: the expected result
--CREDITS--
Antonio Diaz Ruiz <[email protected]>
--INI--
assert.bail=true
--SKIPIF--
<?php include('skipif.inc'); ?>
--ENV--
XML_FILE=/not_well_formed5.xml
LOAD_OPTIONS=0
EXPECTED_RESULT=0
--FILE_EXTERNAL--
domdocumentload_test_method.php
--EXPECTF--
Warning: DOMDocument::load%r(XML){0,1}%r(): Extra content at the end of the document %s
Loading

0 comments on commit 24f3693

Please sign in to comment.