MediaWiki  1.33.0
MediaWikiTestCaseSchema1Test.php
Go to the documentation of this file.
1 <?php
3 
11 
12  public static $hasRun = false;
13 
14  public function setUp() {
15  parent::setUp();
16  // FIXME: fails under postgres
17  $this->markTestSkippedIfDbType( 'postgres' );
18  }
19 
21  return [
22  'create' => [ 'MediaWikiTestCaseTestTable', 'imagelinks' ],
23  'drop' => [ 'oldimage' ],
24  'alter' => [ 'pagelinks' ],
25  'scripts' => [ __DIR__ . '/MediaWikiTestCaseSchemaTest.sql' ]
26  ];
27  }
28 
30  // The test must be run before the second test
31  self::$hasRun = true;
32  $this->assertTrue( self::$hasRun );
33  }
34 
35  public function testTableWasCreated() {
36  // Make sure MediaWikiTestCaseTestTable was created.
37  $this->assertTrue( $this->db->tableExists( 'MediaWikiTestCaseTestTable' ) );
38  }
39 
40  public function testTableWasDropped() {
41  // Make sure oldimage was dropped
42  $this->assertFalse( $this->db->tableExists( 'oldimage' ) );
43  }
44 
45  public function testTableWasOverriden() {
46  // Make sure imagelinks was overwritten
47  $this->assertTrue( $this->db->tableExists( 'imagelinks' ) );
48  $this->assertTrue( $this->db->fieldExists( 'imagelinks', 'il_frobnitz' ) );
49  }
50 
51  public function testTableWasAltered() {
52  // Make sure pagelinks was altered
53  $this->assertTrue( $this->db->tableExists( 'pagelinks' ) );
54  $this->assertTrue( $this->db->fieldExists( 'pagelinks', 'pl_frobnitz' ) );
55  }
56 
57 }
MediaWikiTestCaseSchema1Test\$hasRun
static $hasRun
Definition: MediaWikiTestCaseSchema1Test.php:12
MediaWikiTestCaseSchema1Test\setUp
setUp()
Definition: MediaWikiTestCaseSchema1Test.php:14
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
MediaWikiTestCaseSchema1Test\testTableWasDropped
testTableWasDropped()
Definition: MediaWikiTestCaseSchema1Test.php:40
MediaWikiTestCase
Definition: MediaWikiTestCase.php:17
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
MediaWikiTestCaseSchema1Test\testMediaWikiTestCaseSchemaTestOrder
testMediaWikiTestCaseSchemaTestOrder()
Definition: MediaWikiTestCaseSchema1Test.php:29
MediaWikiTestCaseSchema1Test\testTableWasOverriden
testTableWasOverriden()
Definition: MediaWikiTestCaseSchema1Test.php:45
MediaWikiTestCaseSchema1Test
MediaWikiTestCase.
Definition: MediaWikiTestCaseSchema1Test.php:10
MediaWikiTestCase\markTestSkippedIfDbType
markTestSkippedIfDbType( $type)
Skip the test if using the specified database type.
Definition: MediaWikiTestCase.php:2303
MediaWikiTestCaseSchema1Test\testTableWasAltered
testTableWasAltered()
Definition: MediaWikiTestCaseSchema1Test.php:51
Wikimedia\Rdbms\IMaintainableDatabase
Advanced database interface for IDatabase handles that include maintenance methods.
Definition: IMaintainableDatabase.php:38
MediaWikiTestCase\$db
Database $db
Primary database.
Definition: MediaWikiTestCase.php:61
MediaWikiTestCaseSchema1Test\getSchemaOverrides
getSchemaOverrides(IMaintainableDatabase $db)
Stub.
Definition: MediaWikiTestCaseSchema1Test.php:20
MediaWikiTestCaseSchema1Test\testTableWasCreated
testTableWasCreated()
Definition: MediaWikiTestCaseSchema1Test.php:35