Example #1
1
 /**
  * Tests JFeedParser::registerNamespace()
  *
  * @return  void
  *
  * @since   12.3
  */
 public function testRegisterNamespace()
 {
     // For a new object we nave no namespaces.
     $this->assertAttributeEmpty('namespaces', $this->_instance);
     // Add a new namespace.
     $mock = $this->getMock('JFeedParserNamespace');
     $this->_instance->registerNamespace('foo', $mock);
     $this->assertAttributeEquals(array('foo' => $mock), 'namespaces', $this->_instance);
     // Add the namespace again for a different prefix.
     $this->_instance->registerNamespace('bar', $mock);
     $this->assertAttributeEquals(array('foo' => $mock, 'bar' => $mock), 'namespaces', $this->_instance);
 }
Example #2
1
 /**
  * Tests JFeedParser::registerNamespace() with an expected failure.  Cannot register a handler
  * that isn't an instance of JFeedParserNamespace.
  *
  * @return  void
  *
  * @expectedException  PHPUnit_Framework_Error
  * @since              12.3
  */
 public function testRegisterNamespaceWithObject()
 {
     if (PHP_MAJOR_VERSION >= 7) {
         $this->markTestSkipped('A fatal error is thrown on PHP 7 due to the typehinting of the method.');
     }
     $this->_instance->registerNamespace('foo', new stdClass());
 }
 /**
  * Return the static value.
  *
  * @return  mixed
  *
  * @see     JFeedParser::parse()
  * @since   12.3
  */
 public function parse()
 {
     if (is_null(self::$parseReturn)) {
         return parent::parse();
     }
     $return = self::$parseReturn;
     self::$parseReturn = null;
     return $return;
 }
 /**
  * Method to parse a specific feed element.
  *
  * @param   JFeed             $feed        The JFeed object being built from the parsed feed.
  * @param   SimpleXMLElement  $el          The current XML element object to handle.
  * @param   array             $namespaces  The array of relevant namespace objects to process for the element.
  *
  * @return  void
  *
  * @since   3.0
  */
 public function processElement(JFeed $feed, SimpleXMLElement $el, array $namespaces)
 {
     parent::processElement($feed, $el, $namespaces);
 }
 /**
  * Tests JFeedParser::registerNamespace() with an expected failure.  Cannot register a handler
  * that isn't an instance of JFeedParserNamespace.
  *
  * @return  void
  *
  * @covers             JFeedParser::registerNamespace
  * @expectedException  PHPUnit_Framework_Error
  * @since              12.3
  */
 public function testRegisterNamespaceWithObject()
 {
     $this->_instance->registerNamespace('foo', new stdClass());
 }
 /**
  * Tests JFeedFactory::registerParser()
  *
  * @return  void
  *
  * @covers             JFeedFactory::registerParser
  * @expectedException  InvalidArgumentException
  * @since              12.3
  */
 public function testRegisterParserWithInvalidTag()
 {
     TestReflection::setValue($this->_instance, 'parsers', array());
     $this->_instance->registerParser('42tag', 'JFeedParserMock');
     $this->assertNotEmpty(TestReflection::getValue($this->_instance, 'parsers'));
 }