Browse Source

Add missing tests for user API

master
J. King 11 months ago
parent
commit
a7643a616d
  1. 24
      tests/cases/MicroformatsTest.php
  2. 1
      tests/cases/StandardTest.php
  3. 1
      tests/phpunit.dist.xml

24
tests/cases/MicroformatsTest.php

@ -0,0 +1,24 @@
<?php
/** @license MIT
* Copyright 2023 J. King
* See LICENSE and AUTHORS files for details */
declare(strict_types=1);
namespace MensBeam\Microformats\TestCase;
use MensBeam\Microformats;
/**
* @covers MensBeam\Microformats
*/
class MicroformatsTest extends \PHPUnit\Framework\TestCase {
public function testSerializeToJson(): void {
$exp = '{"items":[{"type":["h-card"],"properties":{}}],"rels":{},"rel-urls":{}}';
$act = Microformats::toJson(Microformats::fromString('<div class="vcard"></div>', "", ""));
$this->assertSame($exp, $act);
}
public function testParseMissingFile(): void {
$this->assertNull(@Microformats::fromFile("THIS FILE DOES NOT EXIST", "", ""));
}
}

1
tests/cases/StandardTest.php

@ -7,7 +7,6 @@ declare(strict_types=1);
namespace MensBeam\Microformats\TestCase;
use MensBeam\Microformats;
use MensBeam\HTML\DOMParser;
/**
* @covers MensBeam\Microformats

1
tests/phpunit.dist.xml

@ -22,6 +22,7 @@
<testsuites>
<testsuite name="Standard">
<file>cases/StandardTest.php</file>
<file>cases/MicroformatsTest.php</file>
</testsuite>
<testsuite name="URL">
<file>cases/Url/UrlTest.php</file>

Loading…
Cancel
Save