public function testJpegMetadataExtraction() {
$file = $this->dataFile( 'test.jpg', 'image/jpeg' );
$res = $this->handler->getMetadata( $file, $this->filePath . 'test.jpg' );
+ // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
$expected = 'a:7:{s:16:"ImageDescription";s:9:"Test file";s:11:"XResolution";s:4:"72/1";s:11:"YResolution";s:4:"72/1";s:14:"ResolutionUnit";i:2;s:16:"YCbCrPositioning";i:1;s:15:"JPEGFileComment";a:1:{i:0;s:17:"Created with GIMP";}s:22:"MEDIAWIKI_EXIF_VERSION";i:2;}';
+ // @codingStandardsIgnoreEnd
// Unserialize in case serialization format ever changes.
$this->assertEquals( unserialize( $expected ), unserialize( $res ) );
array( '', PNGHandler::METADATA_BAD ),
array( null, PNGHandler::METADATA_BAD ),
array( 'Something invalid!', PNGHandler::METADATA_BAD ),
+ // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
array( 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:8;s:9:"colorType";s:10:"truecolour";s:8:"metadata";a:1:{s:15:"_MW_PNG_VERSION";i:1;}}', PNGHandler::METADATA_GOOD ),
+ // @codingStandardsIgnoreEnd
);
}
public static function provideGetMetadata() {
return array(
+ // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
array( 'rgb-na-png.png', 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:8;s:9:"colorType";s:10:"truecolour";s:8:"metadata";a:1:{s:15:"_MW_PNG_VERSION";i:1;}}' ),
array( 'xmp.png', 'a:6:{s:10:"frameCount";i:0;s:9:"loopCount";i:1;s:8:"duration";d:0;s:8:"bitDepth";i:1;s:9:"colorType";s:14:"index-coloured";s:8:"metadata";a:2:{s:12:"SerialNumber";s:9:"123456789";s:15:"_MW_PNG_VERSION";i:1;}}' ),
+ // @codingStandardsIgnoreEnd
);
}
public static function provideSvgFilesWithXMLMetadata() {
$base = __DIR__ . '/../../data/media';
+ // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
$metadata = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<ns4:Work xmlns:ns4="http://creativecommons.org/ns#" rdf:about="">
<ns5:format xmlns:ns5="http://purl.org/dc/elements/1.1/">image/svg+xml</ns5:format>
<ns5:type xmlns:ns5="http://purl.org/dc/elements/1.1/" rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
</ns4:Work>
</rdf:RDF>';
+ // @codingStandardsIgnoreEnd
+
$metadata = str_replace( "\r", '', $metadata ); // Windows compat
return array(
array(
return array(
array( 'Tux.svg', array(
'ObjectName' => 'Tux',
- 'ImageDescription' => 'For more information see: http://commons.wikimedia.org/wiki/Image:Tux.svg',
+ 'ImageDescription' =>
+ 'For more information see: http://commons.wikimedia.org/wiki/Image:Tux.svg',
) ),
array( 'Wikimedia-logo.svg', array() )
);
*/
public function testTiffMetadataExtraction() {
$res = $this->handler->getMetadata( null, $this->filePath . 'test.tiff' );
+
+ // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
$expected = 'a:16:{s:10:"ImageWidth";i:20;s:11:"ImageLength";i:20;s:13:"BitsPerSample";a:3:{i:0;i:8;i:1;i:8;i:2;i:8;}s:11:"Compression";i:5;s:25:"PhotometricInterpretation";i:2;s:16:"ImageDescription";s:17:"Created with GIMP";s:12:"StripOffsets";i:8;s:11:"Orientation";i:1;s:15:"SamplesPerPixel";i:3;s:12:"RowsPerStrip";i:64;s:15:"StripByteCounts";i:238;s:11:"XResolution";s:19:"1207959552/16777216";s:11:"YResolution";s:19:"1207959552/16777216";s:19:"PlanarConfiguration";i:1;s:14:"ResolutionUnit";i:2;s:22:"MEDIAWIKI_EXIF_VERSION";i:2;}';
+ // @codingStandardsIgnoreEnd
+
// Re-unserialize in case there are subtle differences between how versions
// of php serialize stuff.
$this->assertEquals( unserialize( $expected ), unserialize( $res ) );
( $i > UNICODE_SURROGATE_LAST && $i < 0xfffe ) ||
( $i > 0xffff && $i <= UNICODE_MAX )
) {
- if ( isset( UtfNormal::$utfCanonicalComp[$char] ) || isset( UtfNormal::$utfCanonicalDecomp[$char] ) ) {
+ if ( isset( UtfNormal::$utfCanonicalComp[$char] )
+ || isset( UtfNormal::$utfCanonicalDecomp[$char] )
+ ) {
$comp = UtfNormal::NFC( $char );
$this->assertEquals(
bin2hex( $comp ),
}
} elseif ( $first > 0xc1 && $first < 0xe0 && $second < 0xc0 ) {
$this->assertEquals(
- bin2hex( UtfNormal::NFC( $head . chr( $first ) . chr( $second ) ) . UTF8_REPLACEMENT . $tail ),
+ bin2hex( UtfNormal::NFC( $head . chr( $first ) .
+ chr( $second ) ) . UTF8_REPLACEMENT . $tail ),
bin2hex( $clean ),
"Valid 2-byte $x + broken tail" );
} elseif ( $second > 0xc1 && $second < 0xe0 && $third < 0xc0 ) {
$this->assertEquals(
- bin2hex( $head . UTF8_REPLACEMENT . UtfNormal::NFC( chr( $second ) . chr( $third ) . $tail ) ),
+ bin2hex( $head . UTF8_REPLACEMENT .
+ UtfNormal::NFC( chr( $second ) . chr( $third ) . $tail ) ),
bin2hex( $clean ),
"Broken head + valid 2-byte $x" );
} elseif ( ( $first > 0xfd || $second > 0xfd ) &&
$this->cache->add( $key1, $value1 );
$this->cache->add( $key2, $value2 );
- $this->assertEquals( $this->cache->getMulti( array( $key1, $key2 ) ), array( $key1 => $value1, $key2 => $value2 ) );
+ $this->assertEquals(
+ $this->cache->getMulti( array( $key1, $key2 ) ),
+ array( $key1 => $value1, $key2 => $value2 )
+ );
// cleanup
$this->cache->delete( $key1 );
# Needs a title to do magic word stuff
$title = Title::newFromText( 'Tests' );
- $title->mRedirect = false; # Else it needs a db connection just to check if it's a redirect (when deciding the page language)
+ # Else it needs a db connection just to check if it's a redirect
+ # (when deciding the page language).
+ $title->mRedirect = false;
$this->testParser->setTitle( $title );
}
),
), $out->getSections(), 'getSections() with proper value when <h2> is used' );
}
- //@Todo Add tests for cleanSig() / cleanSigInSig(), getSection(), replaceSection(), getPreloadText()
+ // @todo Add tests for cleanSig() / cleanSigInSig(), getSection(),
+ // replaceSection(), getPreloadText()
}
global $wgParserConf, $wgContLang;
parent::setUp();
$this->mOptions = ParserOptions::newFromUserAndLang( new User, $wgContLang );
- $name = isset( $wgParserConf['preprocessorClass'] ) ? $wgParserConf['preprocessorClass'] : 'Preprocessor_DOM';
+ $name = isset( $wgParserConf['preprocessorClass'] )
+ ? $wgParserConf['preprocessorClass']
+ : 'Preprocessor_DOM';
$this->mPreprocessor = new $name( $this );
}
}
public static function provideCases() {
+ // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
return array(
array( "Foo", "<root>Foo</root>" ),
array( "<!-- Foo -->", "<root><comment><!-- Foo --></comment></root>" ),
array( "{{Foo|} Bar=}}", "<root><template><title>Foo</title><part><name>} Bar</name>=<value></value></part></template></root>" ),
/* array( file_get_contents( __DIR__ . '/QuoteQuran.txt' ), file_get_contents( __DIR__ . '/QuoteQuranExpanded.txt' ) ), */
);
+ // @codingStandardsIgnoreEnd
}
/**
* These are more complex test cases taken out of wiki articles.
*/
public static function provideFiles() {
+ // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
return array(
array( "QuoteQuran" ), # http://en.wikipedia.org/w/index.php?title=Template:QuoteQuran/sandbox&oldid=237348988 GFDL + CC BY-SA by Striver
array( "Factorial" ), # http://en.wikipedia.org/w/index.php?title=Template:Factorial&oldid=98548758 GFDL + CC BY-SA by Polonium
array( "Fundraising" ), # http://tl.wiktionary.org/w/index.php?title=MediaWiki:Sitenotice&oldid=5716 GFDL + CC BY-SA, copied there by Sky Harbor.
array( "NestedTemplates" ), # bug 27936
);
+ // @codingStandardsIgnoreEnd
}
/**
* Tests from Bug 28642 ยท https://bugzilla.wikimedia.org/28642
*/
public static function provideHeadings() {
+ // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
return array( /* These should become headings: */
array( "== h ==<!--c1-->", "<root><h level=\"2\" i=\"1\">== h ==<comment><!--c1--></comment></h></root>" ),
array( "== h == <!--c1-->", "<root><h level=\"2\" i=\"1\">== h == <comment><!--c1--></comment></h></root>" ),
array( "== h ==<!--c1--> x <!--c2--><!--c3--> ", "<root>== h ==<comment><!--c1--></comment> x <comment><!--c2--></comment><comment><!--c3--></comment> </root>" ),
array( "== h ==<!--c1--><!--c2--><!--c3--> x ", "<root>== h ==<comment><!--c1--></comment><comment><!--c2--></comment><comment><!--c3--></comment> x </root>" ),
);
+ // @codingStandardsIgnoreEnd
}
/**