forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'pull-request/325' into PHP-5.5
* pull-request/325: Add schema default/fixed value support
- Loading branch information
Showing
12 changed files
with
137 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
ext/dom/tests/DOMDocument_schemaValidateSource_addAttrs.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--TEST-- | ||
DomDocument::schemaValidateSource() - Add missing attribute default values from schema | ||
--CREDITS-- | ||
Chris Wright <[email protected]> | ||
--SKIPIF-- | ||
<?php require_once('skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
$doc = new DOMDocument; | ||
|
||
$doc->load(dirname(__FILE__)."/book-attr.xml"); | ||
|
||
$xsd = file_get_contents(dirname(__FILE__)."/book.xsd"); | ||
|
||
$doc->schemaValidateSource($xsd, LIBXML_SCHEMA_CREATE); | ||
|
||
foreach ($doc->getElementsByTagName('book') as $book) { | ||
var_dump($book->getAttribute('is-hardback')); | ||
} | ||
|
||
?> | ||
--EXPECT-- | ||
string(5) "false" | ||
string(4) "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
ext/dom/tests/DOMDocument_schemaValidateSource_missingAttrs.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--TEST-- | ||
DomDocument::schemaValidateSource() - Don't add missing attribute default values from schema | ||
--CREDITS-- | ||
Chris Wright <[email protected]> | ||
--SKIPIF-- | ||
<?php require_once('skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
$doc = new DOMDocument; | ||
|
||
$doc->load(dirname(__FILE__)."/book-attr.xml"); | ||
|
||
$xsd = file_get_contents(dirname(__FILE__)."/book.xsd"); | ||
|
||
$doc->schemaValidateSource($xsd); | ||
|
||
foreach ($doc->getElementsByTagName('book') as $book) { | ||
var_dump($book->getAttribute('is-hardback')); | ||
} | ||
|
||
?> | ||
--EXPECT-- | ||
string(0) "" | ||
string(4) "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--TEST-- | ||
DomDocument::schemaValidate() - Add missing attribute default values from schema | ||
--CREDITS-- | ||
Chris Wright <[email protected]> | ||
--SKIPIF-- | ||
<?php require_once('skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
$doc = new DOMDocument; | ||
|
||
$doc->load(dirname(__FILE__)."/book-attr.xml"); | ||
|
||
$doc->schemaValidate(dirname(__FILE__)."/book.xsd", LIBXML_SCHEMA_CREATE); | ||
|
||
foreach ($doc->getElementsByTagName('book') as $book) { | ||
var_dump($book->getAttribute('is-hardback')); | ||
} | ||
|
||
?> | ||
--EXPECT-- | ||
string(5) "false" | ||
string(4) "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
ext/dom/tests/DOMDocument_schemaValidate_missingAttrs.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--TEST-- | ||
DomDocument::schemaValidate() - Don't add missing attribute default values from schema | ||
--CREDITS-- | ||
Chris Wright <[email protected]> | ||
--SKIPIF-- | ||
<?php require_once('skipif.inc'); ?> | ||
--FILE-- | ||
<?php | ||
|
||
$doc = new DOMDocument; | ||
|
||
$doc->load(dirname(__FILE__)."/book-attr.xml"); | ||
|
||
$doc->schemaValidate(dirname(__FILE__)."/book.xsd"); | ||
|
||
foreach ($doc->getElementsByTagName('book') as $book) { | ||
var_dump($book->getAttribute('is-hardback')); | ||
} | ||
|
||
?> | ||
--EXPECT-- | ||
string(0) "" | ||
string(4) "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" ?> | ||
<books> | ||
<book> | ||
<title>The Grapes of Wrath</title> | ||
<author>John Steinbeck</author> | ||
</book> | ||
<book is-hardback="true"> | ||
<title>The Pearl</title> | ||
<author>John Steinbeck</author> | ||
</book> | ||
</books> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters