Ejemplo n.º 1
0
 /**
  * Tests the JFeed::addContributor method.
  *
  * @return  void
  *
  * @since   3.0
  *
  * @covers  JFeed::addContributor
  */
 public function testAddContributor()
 {
     $this->object->addContributor('Dennis Ritchie', '*****@*****.**');
     $properties = TestReflection::getValue($this->object, 'properties');
     // Make sure the contributor we added actually exists.
     $this->assertTrue(in_array(new JFeedPerson('Dennis Ritchie', '*****@*****.**'), $properties['contributors']));
     $this->object->addContributor('Dennis Ritchie', '*****@*****.**');
     $properties = TestReflection::getValue($this->object, 'properties');
     // Make sure we aren't adding the same contributor more than once.
     $this->assertTrue(count($properties['contributors']) == 1);
 }
Ejemplo n.º 2
0
 /**
  * Method to handle the <webmaster> element for the feed.
  *
  * @param   JFeed             $feed  The JFeed object being built from the parsed feed.
  * @param   SimpleXMLElement  $el    The current XML element object to handle.
  *
  * @return  void
  *
  * @since   12.3
  */
 protected function handleWebmaster(JFeed $feed, SimpleXMLElement $el)
 {
     // Get the tag contents and split it over the first space.
     $tmp = (string) $el;
     $tmp = explode(' ', $tmp, 2);
     // This is really cheap parsing.  Probably need to create a method to do this more robustly.
     $name = null;
     if (isset($tmp[1])) {
         $name = trim($tmp[1], ' ()');
     }
     $email = trim($tmp[0]);
     $feed->addContributor($name, $email, null, 'webmaster');
 }
Ejemplo n.º 3
0
 /**
  * Method to handle the <contributor> element for the feed.
  *
  * @param   JFeed             $feed  The JFeed object being built from the parsed feed.
  * @param   SimpleXMLElement  $el    The current XML element object to handle.
  *
  * @return  void
  *
  * @since   12.3
  */
 protected function handleContributor(JFeed $feed, SimpleXMLElement $el)
 {
     $feed->addContributor((string) $el->name, (string) $el->email, (string) $el->uri);
 }