Page Menu
Home
Code
Search
Configure Global Search
Log In
Files
F15619685
XmlDocumentTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
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, Nov 26, 02:16 (1 d, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
21321
Default Alt Text
XmlDocumentTest.php (1 KB)
Attached To
Mode
rZED Zed
Attached
Detach File
Event Timeline
Log In to Comment