Example #1
0
 public function testParsesHCardHEntriesFromProfilePage()
 {
     $input = file_get_contents('./tests/Mf2/example-twitter-2.html');
     $output = Mf2\Shim\parseTwitter($input, 'https://twitter.com/briansuda');
     $this->assertArrayHasKey('items', $output);
     return $output;
 }
Example #2
0
function mfForResponse(Guzzle\Http\Message\Response $resp)
{
    $html = $resp->getBody(true);
    $host = parse_url($resp->getEffectiveUrl(), PHP_URL_HOST);
    if ($host == 'twitter.com') {
        return Mf2\Shim\parseTwitter($html, $resp->getEffectiveUrl());
    } elseif ($host == 'facebook.com') {
        return Mf2\Shim\parseFacebook($html, $resp->getEffectiveUrl());
    } else {
        return Mf2\parse($html, $resp->getEffectiveUrl());
    }
}
Example #3
0
 public function testPreprocessesTweetContent()
 {
     $input = file_get_contents('./tests/Mf2/kartikprabhu-twitter.html');
     $output = Mf2\shim\parseTwitter($input, 'https://twitter.com/kartik_prabhu/status/449032538476929024');
     $this->assertEquals('The #indieweb or: how I learnt to stop worrying and love the #blog. Comes about a year since I went indie (http://kartikprabhu.com/article/indieweb-love-blog)', $output['items'][0]['properties']['content'][0]['value']);
 }