MediaWiki  1.29.2
ApiQueryContinue2Test.php
Go to the documentation of this file.
1 <?php
29 
35  function addDBDataOnce() {
36  try {
37  $this->editPage( 'AQCT73462-A', '**AQCT73462-A** [[AQCT73462-B]] [[AQCT73462-C]]' );
38  $this->editPage( 'AQCT73462-B', '[[AQCT73462-A]] **AQCT73462-B** [[AQCT73462-C]]' );
39  $this->editPage( 'AQCT73462-C', '[[AQCT73462-A]] [[AQCT73462-B]] **AQCT73462-C**' );
40  $this->editPage( 'AQCT73462-A', '**AQCT73462-A** [[AQCT73462-B]] [[AQCT73462-C]]' );
41  $this->editPage( 'AQCT73462-B', '[[AQCT73462-A]] **AQCT73462-B** [[AQCT73462-C]]' );
42  $this->editPage( 'AQCT73462-C', '[[AQCT73462-A]] [[AQCT73462-B]] **AQCT73462-C**' );
43  } catch ( Exception $e ) {
44  $this->exceptionFromAddDBData = $e;
45  }
46  }
47 
51  public function testA() {
52  $this->mVerbose = false;
53  $mk = function ( $g, $p, $gDir ) {
54  return [
55  'generator' => 'allpages',
56  'gapprefix' => 'AQCT73462-',
57  'prop' => 'links',
58  'gaplimit' => "$g",
59  'pllimit' => "$p",
60  'gapdir' => $gDir ? "ascending" : "descending",
61  ];
62  };
63  // generator + 1 prop + 1 list
64  $data = $this->query( $mk( 99, 99, true ), 1, 'g1p', false ) +
65  [ 'batchcomplete' => true ];
66  $this->checkC( $data, $mk( 1, 1, true ), 6, 'g1p-11t' );
67  $this->checkC( $data, $mk( 2, 2, true ), 3, 'g1p-22t' );
68  $this->checkC( $data, $mk( 1, 1, false ), 6, 'g1p-11f' );
69  $this->checkC( $data, $mk( 2, 2, false ), 3, 'g1p-22f' );
70  }
71 }
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
ApiQueryContinue2Test\addDBDataOnce
addDBDataOnce()
Definition: ApiQueryContinue2Test.php:35
ApiQueryContinue2Test\$exceptionFromAddDBData
$exceptionFromAddDBData
Definition: ApiQueryContinue2Test.php:28
ApiQueryContinue2Test\testA
testA()
@medium
Definition: ApiQueryContinue2Test.php:51
ApiQueryContinueTestBase\checkC
checkC( $expected, $params, $expectedCount, $id, $continue=true)
Run query() and compare against expected values.
Definition: ApiQueryContinueTestBase.php:40
$e
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
Definition: hooks.txt:2122
ApiTestCase\editPage
editPage( $pageName, $text, $summary='', $defaultNs=NS_MAIN)
Edits or creates a page/revision.
Definition: ApiTestCase.php:50
ApiQueryContinue2Test
Copyright © 2013 Yuri Astrakhan "<Firstname><Lastname>@gmail.com".
Definition: ApiQueryContinue2Test.php:27
ApiQueryContinueTestBase
Definition: ApiQueryContinueTestBase.php:24
ApiQueryContinueTestBase\query
query( $params, $expectedCount, $id, $useContinue=true)
Run query in a loop until no more values are available.
Definition: ApiQueryContinueTestBase.php:54
true
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return true
Definition: hooks.txt:1956