J. King 11 months ago
parent
commit
f5b221d955
  1. 24
      tests/cases/StandardTest.php
  2. 4
      tests/cases/json/phpmf2/hentry/mixedroots.json

24
tests/cases/StandardTest.php

@ -8,6 +8,7 @@ namespace MensBeam\Microformats\TestCase;
use MensBeam\Microformats\Parser;
use MensBeam\HTML\DOMParser;
use MensBeam\Microformats\Url;
/** @covers MensBeam\Microformats\Parser */
class StandardTest extends \PHPUnit\Framework\TestCase {
@ -114,6 +115,24 @@ class StandardTest extends \PHPUnit\Framework\TestCase {
break;
case "phpmf2/hentry/fberriman":
$this->fixDates($exp['items'][0]['properties']['published']);
break;
case "phpmf2/hentry/mixedroots":
$this->fixUrls($exp['items'][0]['properties']['comment'][0]['properties']['published']);
$this->fixUrls($exp['items'][0]['properties']['comment'][0]['properties']['updated']);
$this->fixUrls($exp['items'][0]['properties']['comment'][0]['properties']['comment'][0]['properties']['published']);
$this->fixUrls($exp['items'][0]['properties']['comment'][0]['properties']['comment'][0]['properties']['updated']);
$this->fixUrls($exp['items'][0]['properties']['comment'][1]['properties']['published']);
$this->fixUrls($exp['items'][0]['properties']['comment'][1]['properties']['updated']);
$this->fixUrls($exp['items'][0]['properties']['comment'][1]['properties']['comment'][0]['properties']['published']);
$this->fixUrls($exp['items'][0]['properties']['comment'][1]['properties']['comment'][0]['properties']['updated']);
$this->fixUrls($exp['items'][0]['properties']['comment'][1]['properties']['comment'][0]['properties']['published']);
$this->fixUrls($exp['items'][0]['properties']['comment'][1]['properties']['comment'][0]['properties']['updated']);
$this->fixUrls($exp['items'][0]['properties']['comment'][1]['properties']['comment'][0]['properties']['comment'][0]['properties']['published']);
$this->fixUrls($exp['items'][0]['properties']['comment'][1]['properties']['comment'][0]['properties']['comment'][0]['properties']['updated']);
$this->fixUrls($exp['items'][0]['properties']['comment'][1]['properties']['comment'][0]['properties']['comment'][0]['properties']['comment'][0]['properties']['published']);
$this->fixUrls($exp['items'][0]['properties']['comment'][1]['properties']['comment'][0]['properties']['comment'][0]['properties']['comment'][0]['properties']['updated']);
$this->fixUrls($exp['items'][0]['properties']['comment'][2]['properties']['published']);
$this->fixUrls($exp['items'][0]['properties']['comment'][2]['properties']['updated']);
}
return $exp;
}
@ -126,4 +145,9 @@ class StandardTest extends \PHPUnit\Framework\TestCase {
}
}
protected function fixUrls(&$urlArray): void {
foreach ($urlArray as &$u) {
$u = (string) Url::fromString(preg_replace('#/$#', "", substr($u, 7)), "http://example.com/");
}
}
}

4
tests/cases/json/phpmf2/hentry/mixedroots.json

@ -265,10 +265,10 @@
"ENUM wurde bisher nur als M\u00f6glichkeit zur Umgehung der Carrier/Kostenersparnis gesehen, dementsprechend nat\u00fcrlich von Carriern und nahestehenden Hard-/Softwareherstellern nicht unterst\u00fctzt. Somit kommt es nicht in den Mainstream. Ich sehe es zur Zeit (leider) als reines \u201cNerd-Tool\u201d, genau wie Diaspora, OpenID, IndieWeb \u2026\nAber der Gedanke eines \u201cdezentralen WhatsApp\u201d auf ENUM-Basis kam mir auch schon. Interessantes Projekt, aber auch nicht massentauglich wegen Huhn&Ei-Problemen."
],
"updated": [
"http://20. Februar 2014 bei 12:1"
"http://20. Februar 2014 bei 12:01"
],
"published": [
"http://20. Februar 2014 bei 12:1"
"http://20. Februar 2014 bei 12:01"
],
"content": [
{

Loading…
Cancel
Save