-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing creating empty nodes for all PHP 'false' values. Closes #14.
- Loading branch information
maciej.majewski
committed
Aug 23, 2012
1 parent
90a91c8
commit 321b13f
Showing
2 changed files
with
32 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
namespace CFPropertyList; | ||
|
||
error_reporting(E_ALL | E_STRICT); | ||
ini_set('display_errors', 'on'); | ||
|
||
if (!defined('LIBDIR')) { | ||
define('LIBDIR', __DIR__ . '/../classes/CFPropertyList'); | ||
} | ||
|
||
require_once(LIBDIR . '/CFPropertyList.php'); | ||
|
||
class EmptyElementsTest extends \PHPUnit_Framework_TestCase { | ||
public function testWriteFile() { | ||
$expected = '<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"><dict><key>string</key><string/><key>number</key><integer>0</integer><key>double</key><real>0</real></dict></plist> | ||
'; | ||
|
||
$plist = new CFPropertyList(); | ||
$dict = new CFDictionary(); | ||
|
||
$dict->add('string', new CFString('')); | ||
$dict->add('number', new CFNumber(0)); | ||
$dict->add('double', new CFNumber(0.0)); | ||
|
||
$plist->add($dict); | ||
$this->assertEquals($expected, $plist->toXML()); | ||
} | ||
} |