Page MenuHomeDevCentral

ParserTest.php
No OneTemporary

ParserTest.php

<?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

Mime Type
text/x-php
Expires
Tue, Nov 18, 18:03 (9 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3160522
Default Alt Text
ParserTest.php (1 KB)

Event Timeline