public function isSupportedFormat($format)
 {
     // Necessary for backwards-compatability where
     // the format "json" was used
     if ($format === 'json') {
         $format = CONTENT_FORMAT_JSON;
     }
     return parent::isSupportedFormat($format);
 }
Exemplo n.º 2
0
 /**
  * Returns the content handler appropriate for this revision's content model.
  *
  * @throws MWException
  * @return ContentHandler
  */
 public function getContentHandler()
 {
     if (!$this->mContentHandler) {
         $model = $this->getContentModel();
         $this->mContentHandler = ContentHandler::getForModelID($model);
         $format = $this->getContentFormat();
         if (!$this->mContentHandler->isSupportedFormat($format)) {
             throw new MWException("Oops, the content format {$format} is not supported for this content model, {$model}");
         }
     }
     return $this->mContentHandler;
 }
 /**
  * @dataProvider dataIsSupportedFormat
  * @covers WikitextContentHandler::isSupportedFormat
  */
 public function testIsSupportedFormat($format, $supported)
 {
     $this->assertEquals($supported, $this->handler->isSupportedFormat($format));
 }