示例#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);
 }
示例#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());
 }
 /**
  * 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());
 }