Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F12945992
ParserTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
ParserTest.php
View Options
<?php
namespace
Keruald\Yaml\Tests
;
use
Keruald\Yaml\Parser
;
use
PHPUnit\Framework\TestCase
;
use
InvalidArgumentException
;
class
ParserTest
extends
TestCase
{
private
Parser
$parser
;
protected
function
setUp
()
:
void
{
$this
->
parser
=
new
Parser
;
}
public
function
testParse
()
{
$this
->
assertEquals
(
666
,
$this
->
parser
->
parse
(
"666"
));
$this
->
assertEquals
(
""
,
$this
->
parser
->
parse
(
""
));
}
public
function
testParseUnknownTag
()
{
$this
->
expectException
(
InvalidArgumentException
::
class
);
$this
->
expectExceptionMessage
(
"Tag not found: foo"
);
$this
->
parser
->
parse
(
"!foo 4"
);
}
public
function
testParseFile
()
{
$expected
=
[
"example"
=>
[
"foo"
=>
"bar"
,
"skills"
=>
[
"quux"
,
"baz"
,
],
],
];
$actual
=
$this
->
parser
->
parseFile
(
__DIR__
.
"/data/example.yaml"
);
$this
->
assertEquals
(
$expected
,
$actual
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, Nov 18, 18:03 (10 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3160522
Default Alt Text
ParserTest.php (1 KB)
Attached To
Mode
rKERUALD Keruald libraries development repository
Attached
Detach File
Event Timeline
Log In to Comment