# Revision 33 samples
# expected, rule, number, comment
+ // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
array( 0, 'n in 1,3,5@integer 3~10, 103~110, 1003, … @decimal 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 103.0, 1003.0, …', 3, 'samples' ),
+ // @codingStandardsIgnoreEnd
# Revision 33 some test cases from CLDR
array( 0, 'i = 1 and v = 0 or i = 0 and t = 1', '0.1', 'pt one' ),
array( 1, 'i = 1 and v = 0 or i = 0 and t = 1', '0.2', 'pt other' ),
array( 1, 'i = 1 and v = 0 or i = 0 and t = 1', '10.0', 'pt other' ),
array( 1, 'i = 1 and v = 0 or i = 0 and t = 1', '100.0', 'pt other' ),
+ // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
array( 0, 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14', '2', 'bs few' ),
array( 0, 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14', '4', 'bs few' ),
array( 0, 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14', '22', 'bs few' ),
array( 0, 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14', '0.4', 'bs few' ),
array( 0, 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14', '10.2', 'bs few' ),
array( 1, 'v = 0 and i % 10 = 2..4 and i % 100 != 12..14 or f % 10 = 2..4 and f % 100 != 12..14', '10.0', 'bs other' ),
-
+ // @codingStandardsIgnoreEnd
);
return $tests;
* @throws MWExcepion
*/
protected function addRevision( Page $page, $text, $summary ) {
- $status = $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), $summary );
+ $status = $page->doEditContent(
+ ContentHandler::makeContent( $text, $page->getTitle() ),
+ $summary
+ );
+
if ( $status->isGood() ) {
$value = $status->getValue();
$revision = $value['revision'];
$revision_id = $revision->getId();
$text_id = $revision->getTextId();
+
if ( ( $revision_id > 0 ) && ( $text_id > 0 ) ) {
return array( $revision_id, $text_id );
}
}
+
throw new MWException( "Could not determine revision id (" . $status->getWikiText() . ")" );
}
$this->assertEquals( '', array_pop( $lines ), "Output ends in LF" );
$timestamp_re = "[0-9]{4}-[01][0-9]-[0-3][0-9] [0-2][0-9]:[0-5][0-9]:[0-6][0-9]";
foreach ( $lines as $line ) {
- $this->assertRegExp( "/$timestamp_re: .* \(ID [0-9]+\) [0-9]* pages .*, [0-9]* revs .*, ETA/", $line );
+ $this->assertRegExp(
+ "/$timestamp_re: .* \(ID [0-9]+\) [0-9]* pages .*, [0-9]* revs .*, ETA/",
+ $line
+ );
}
}
* @param string $format The expected format model id (default: CONTENT_FORMAT_WIKITEXT)
* @param int|bool $parentid (optional) id of the parent revision
*/
- protected function assertRevision( $id, $summary, $text_id, $text_bytes, $text_sha1, $text = false, $parentid = false,
+ protected function assertRevision( $id, $summary, $text_id, $text_bytes,
+ $text_sha1, $text = false, $parentid = false,
$model = CONTENT_MODEL_WIKITEXT, $format = CONTENT_FORMAT_WIKITEXT
) {
$this->assertNodeStart( "revision" );
$fname = $this->getNewTempFile();
// The header of every prefetch file
+ // @codingStandardsIgnoreStart Ignore Generic.Files.LineLength.TooLong
$header = '<mediawiki xmlns="http://www.mediawiki.org/xml/export-0.7/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.mediawiki.org/xml/export-0.7/ http://www.mediawiki.org/xml/export-0.7.xsd" version="0.7" xml:lang="en">
<siteinfo>
<sitename>wikisvn</sitename>
</namespaces>
</siteinfo>
';
+ // @codingStandardsIgnoreEnd
// An array holding the pages that are available for prefetch
$available_pages = array();
$this->assertEmpty( $files, "Remaining unchecked files" );
// ... and have dealt with more than one checkpoint file
- $this->assertGreaterThan( 1, $checkpointFiles, "expected more than 1 checkpoint to have been created. Checkpoint interval is $checkpointAfter seconds, maybe your computer is too fast?" );
+ $this->assertGreaterThan(
+ 1,
+ $checkpointFiles,
+ "expected more than 1 checkpoint to have been created. "
+ . "Checkpoint interval is $checkpointAfter seconds, maybe your computer is too fast?"
+ );
$this->expectETAOutput();
}
// -> Page is marked deleted. Hence not visible
// Page 4
- $this->assertPageStart( $this->pageId4, $this->talk_namespace, $this->pageTitle4->getPrefixedText() );
+ $this->assertPageStart(
+ $this->pageId4,
+ $this->talk_namespace,
+ $this->pageTitle4->getPrefixedText()
+ );
$this->assertRevision( $this->revId4_1, "Talk BackupDumperTestP1 Summary1",
$this->textId4_1, 35, "nktofwzd0tl192k3zfepmlzxoax1lpe",
"Talk about BackupDumperTestP1 Text1" );
// -> Page is marked deleted. Hence not visible
// Page 4
- $this->assertPageStart( $this->pageId4, $this->talk_namespace, $this->pageTitle4->getPrefixedText() );
+ $this->assertPageStart(
+ $this->pageId4,
+ $this->talk_namespace,
+ $this->pageTitle4->getPrefixedText()
+ );
$this->assertRevision( $this->revId4_1, "Talk BackupDumperTestP1 Summary1",
$this->textId4_1, 35, "nktofwzd0tl192k3zfepmlzxoax1lpe" );
$this->assertPageEnd();
// -> Page is marked deleted. Hence not visible
// Page 4
- $this->assertPageStart( $this->pageId4, $this->talk_namespace, $this->pageTitle4->getPrefixedText() );
+ $this->assertPageStart(
+ $this->pageId4,
+ $this->talk_namespace,
+ $this->pageTitle4->getPrefixedText()
+ );
$this->assertRevision( $this->revId4_1, "Talk BackupDumperTestP1 Summary1",
$this->textId4_1, 35, "nktofwzd0tl192k3zfepmlzxoax1lpe" );
$this->assertPageEnd();
// -> Page is marked deleted. Hence not visible
// Page 4
- $this->assertPageStart( $this->pageId4, $this->talk_namespace, $this->pageTitle4->getPrefixedText() );
+ $this->assertPageStart(
+ $this->pageId4,
+ $this->talk_namespace,
+ $this->pageTitle4->getPrefixedText()
+ );
$this->assertRevision( $this->revId4_1, "Talk BackupDumperTestP1 Summary1",
$this->textId4_1, 35, "nktofwzd0tl192k3zfepmlzxoax1lpe" );
$this->assertPageEnd();
// -> Page is marked deleted. Hence not visible
// Page 4
- $this->assertPageStart( $this->pageId4, $this->talk_namespace, $this->pageTitle4->getPrefixedText() );
+ $this->assertPageStart(
+ $this->pageId4,
+ $this->talk_namespace,
+ $this->pageTitle4->getPrefixedText()
+ );
$this->assertRevision( $this->revId4_1, "Talk BackupDumperTestP1 Summary1",
$this->textId4_1, 35, "nktofwzd0tl192k3zfepmlzxoax1lpe" );
$this->assertPageEnd();
// -> Page is marked deleted. Hence not visible
// Page 4
- $this->assertPageStart( $this->pageId4, $this->talk_namespace, $this->pageTitle4->getPrefixedText() );
+ $this->assertPageStart(
+ $this->pageId4,
+ $this->talk_namespace,
+ $this->pageTitle4->getPrefixedText()
+ );
$this->assertRevision( $this->revId4_1, "Talk BackupDumperTestP1 Summary1",
$this->textId4_1, 35, "nktofwzd0tl192k3zfepmlzxoax1lpe" );
$this->assertPageEnd();
* @throws MWExcepion
*/
private function addRevision( $page, $text, $summary ) {
- $status = $page->doEditContent( ContentHandler::makeContent( $text, $page->getTitle() ), $summary );
+ $status = $page->doEditContent(
+ ContentHandler::makeContent( $text, $page->getTitle() ),
+ $summary
+ );
+
if ( $status->isGood() ) {
$value = $status->getValue();
$revision = $value['revision'];
$id = $revision->getTextId();
+
if ( $id > 0 ) {
return $id;
}
}
+
throw new MWException( "Could not determine text id" );
}
try {
$title = Title::newFromText( 'FetchTextTestPage1', $wikitextNamespace );
$page = WikiPage::factory( $title );
- $this->textId1 = $this->addRevision( $page, "FetchTextTestPage1Text1", "FetchTextTestPage1Summary1" );
+ $this->textId1 = $this->addRevision(
+ $page,
+ "FetchTextTestPage1Text1",
+ "FetchTextTestPage1Summary1"
+ );
$title = Title::newFromText( 'FetchTextTestPage2', $wikitextNamespace );
$page = WikiPage::factory( $title );
- $this->textId2 = $this->addRevision( $page, "FetchTextTestPage2Text1", "FetchTextTestPage2Summary1" );
- $this->textId3 = $this->addRevision( $page, "FetchTextTestPage2Text2", "FetchTextTestPage2Summary2" );
- $this->textId4 = $this->addRevision( $page, "FetchTextTestPage2Text3", "FetchTextTestPage2Summary3" );
- $this->textId5 = $this->addRevision( $page, "FetchTextTestPage2Text4 some additional Text ", "FetchTextTestPage2Summary4 extra " );
+ $this->textId2 = $this->addRevision(
+ $page,
+ "FetchTextTestPage2Text1",
+ "FetchTextTestPage2Summary1"
+ );
+ $this->textId3 = $this->addRevision(
+ $page,
+ "FetchTextTestPage2Text2",
+ "FetchTextTestPage2Summary2"
+ );
+ $this->textId4 = $this->addRevision(
+ $page,
+ "FetchTextTestPage2Text3",
+ "FetchTextTestPage2Summary3"
+ );
+ $this->textId5 = $this->addRevision(
+ $page,
+ "FetchTextTestPage2Text4 some additional Text ",
+ "FetchTextTestPage2Summary4 extra "
+ );
} catch ( Exception $e ) {
// We'd love to pass $e directly. However, ... see
// documentation of exceptionFromAddDBData
* @file
*/
-// Set a flag which can be used to detect when other scripts have been entered through this entry point or not
+// Set a flag which can be used to detect when other scripts have been entered
+// through this entry point or not.
define( 'MW_PHPUNIT_TEST', true );
// Start up MediaWiki in command-line mode
public function __construct() {
parent::__construct();
- $this->addOption( 'with-phpunitdir',
- 'Directory to include PHPUnit from, for example when using a git fetchout from upstream. Path will be prepended to PHP `include_path`.',
+ $this->addOption(
+ 'with-phpunitdir',
+ 'Directory to include PHPUnit from, for example when using a git '
+ . 'fetchout from upstream. Path will be prepended to PHP `include_path`.',
false, # not required
true # need arg
);
$this->testLocalClasses = array(
'TestAutoloadedLocalClass' => __DIR__ . '/../data/autoloader/TestAutoloadedLocalClass.php',
'TestAutoloadedCamlClass' => __DIR__ . '/../data/autoloader/TestAutoloadedCamlClass.php',
- 'TestAutoloadedSerializedClass' => __DIR__ . '/../data/autoloader/TestAutoloadedSerializedClass.php',
+ 'TestAutoloadedSerializedClass' =>
+ __DIR__ . '/../data/autoloader/TestAutoloadedSerializedClass.php',
+ );
+ $this->setMwGlobals(
+ 'wgAutoloadLocalClasses',
+ $this->testLocalClasses + $wgAutoloadLocalClasses
);
- $this->setMwGlobals( 'wgAutoloadLocalClasses', $this->testLocalClasses + $wgAutoloadLocalClasses );
AutoLoader::resetAutoloadLocalClassesLower();
$this->testExtensionClasses = array(
public function testStyleMedia( $moduleName, $media, $filename, $css ) {
$cssText = CSSMin::minify( $css->cssText );
- $this->assertTrue( strpos( $cssText, '@media' ) === false, 'Stylesheets should not both specify "media" and contain @media' );
+ $this->assertTrue(
+ strpos( $cssText, '@media' ) === false,
+ 'Stylesheets should not both specify "media" and contain @media'
+ );
}
public function testDependencies() {
<?php
/**
* This test suite runs unit tests registered by extensions.
- * See https://www.mediawiki.org/wiki/Manual:Hooks/UnitTestsList for details of how to register your tests.
+ * See https://www.mediawiki.org/wiki/Manual:Hooks/UnitTestsList for details of
+ * how to register your tests.
*/
class ExtensionsTestSuite extends PHPUnit_Framework_TestSuite {