Exemple #1
0
 /**
  * A particularly knotty case when we get a webmention from *our
  * own* feed. It looks valid because it includes a link, but it's
  * not really.
  */
 function testAddWebmentions_LocalFeed()
 {
     for ($i = 0; $i < 5; $i++) {
         $entity = new Entity();
         $entity->setOwner($this->user());
         $entity->title = "This post will be the webmention target";
         $entity->publish();
         $entities[] = $entity;
         $this->toDelete[] = $entity;
     }
     // take one from the middle
     $entity = $entities[2];
     $source = \Idno\Core\Idno::site()->config()->url;
     $target = $entity->getURL();
     // render the homepage feed
     $sourceResp = Webservice::get($source);
     $sourceContent = $sourceResp['content'];
     $sourceMf2 = (new \Mf2\Parser($sourceContent, $source))->parse();
     $entity->addWebmentions($source, $target, $sourceResp, $sourceMf2);
     $this->assertEmpty($entity->getAllAnnotations());
 }