Merge "Warn if stateful ParserOutput transforms are used"
[lhc/web/wiklou.git] / tests / phpunit / tests / MediaWikiTestCaseSchema1Test.php
1 <?php
2
3 /**
4 * @covers MediaWikiTestCase
5 *
6 * @group Database
7 * @group MediaWikiTestCaseTest
8 */
9 class MediaWikiTestCaseSchema1Test extends MediaWikiTestCase {
10
11 public static $hasRun = false;
12
13 public function getSchemaOverrides() {
14 return [
15 [ 'imagelinks', 'MediaWikiTestCaseTestTable' ],
16 [ __DIR__ . '/MediaWikiTestCaseSchemaTest.sql' ]
17 ];
18 }
19
20 public function testMediaWikiTestCaseSchemaTestOrder() {
21 // The test must be run before the second test
22 self::$hasRun = true;
23 $this->assertTrue( self::$hasRun );
24 }
25
26 public function testSchemaExtension() {
27 // make sure we can use the MediaWikiTestCaseTestTable table
28
29 $input = [ 'id' => '5', 'name' => 'Test' ];
30
31 $this->db->insert(
32 'MediaWikiTestCaseTestTable',
33 $input
34 );
35
36 $output = $this->db->selectRow( 'MediaWikiTestCaseTestTable', array_keys( $input ), [] );
37 $this->assertEquals( (object)$input, $output );
38 }
39
40 public function testSchemaOverride() {
41 // make sure we can use the il_frobniz field
42
43 $input = [
44 'il_from' => '7',
45 'il_from_namespace' => '0',
46 'il_to' => 'Foo.jpg',
47 'il_frobniz' => 'Xyzzy',
48 ];
49
50 $this->db->insert(
51 'imagelinks',
52 $input
53 );
54
55 $output = $this->db->selectRow( 'imagelinks', array_keys( $input ), [] );
56 $this->assertEquals( (object)$input, $output );
57 }
58
59 }