Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F1136650
XmlDocumentTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
XmlDocumentTest.php
View Options
<?php
namespace
Zed\Tests\Engines\API\Format
;
use
PHPUnit\Framework\Attributes\DataProvider
;
use
PHPUnit\Framework\TestCase
;
use
stdClass
;
use
Zed\Engines\API\Format\XmlDocument
;
class
XmlDocumentTest
extends
TestCase
{
///
/// Data providers
///
public
static
function
provideXmlDocuments
()
:
iterable
{
$dir
=
dirname
(
__DIR__
,
3
)
.
"/data/XmlDocument"
;
yield
[[
1
,
2
,
3
,
4
,
5
],
"$dir/sequence.xml"
];
$ship
=
new
stdClass
;
$ship
->
name
=
"Demios"
;
$ship
->
id
=
400
;
$ship
->
manifest
=
[
12
,
50
,
97
];
yield
[
$ship
,
"$dir/ship.xml"
];
}
///
/// Tests
///
public
function
testToXmlWithScalar
()
{
$expected
=
'<?xml version="1.0" encoding="utf-8"?><foo>666</foo>'
;
$actual
=
XmlDocument
::
toXml
(
666
,
"foo"
);
$this
->
assertEquals
(
$expected
,
str_replace
(
"
\n
"
,
""
,
$actual
));
}
#[DataProvider("provideXmlDocuments")]
public
function
testXml
(
$data
,
$expectedPath
)
{
$expected
=
file_get_contents
(
$expectedPath
);
$this
->
assertEquals
(
$expected
,
XmlDocument
::
toXml
(
$data
));
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Thu, Jul 10, 17:01 (4 w, 14 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
21321
Default Alt Text
XmlDocumentTest.php (1 KB)
Attached To
rZED Zed
Event Timeline
Log In to Comment