Debian Codegraph @

tests/phpunit/unit/includes/editpage/IEditObjectTest.php

raw symbols SCIP
1 <?php
2
3 use MediaWiki\EditPage\EditPage;
4 use MediaWiki\EditPage\IEditObject;
5
6 /**
7 * @covers \MediaWiki\EditPage\EditPage
8 *
9 * MediaWikiCoversValidator fails when trying to say that this covers an interface,
10 * but this covers \MediaWiki\EditPage\IEditObject primarily
11 *
12 * @author DannyS712
13 */
14 class IEditObjectTest extends MediaWikiUnitTestCase {
15
16 public function testConstants() {
17 // Ensure that each of the constants used as a status is unique
18 $reflection = new ReflectionClass( IEditObject::class );
19 $constants = $reflection->getConstants();
20
21 // Keys (constant names) are required to be unique by php, only need to
22 // test the values
23 $values = array_values( $constants );
24 $uniqueValues = array_unique( $values );
25 $this->assertArrayEquals(
26 $values,
27 $uniqueValues,
28 'All status constants have unique values'
29 );
30
31 // Make sure that any old reference to EditPage::AS_* still works
32 foreach ( $constants as $key => $value ) {
33 $this->assertSame(
34 constant( EditPage::class . '::' . $key ),
35 $value,
36 "EditPage::$key still works properly"
37 );
38 }
39 }
40 }