3 use Wikimedia\TestingAccessWrapper
;
6 * @covers ChangesListFilter
8 class ChangesListFilterTest
extends MediaWikiTestCase
{
11 public function setUp() {
12 $this->group
= $this->getGroup( [ 'name' => 'group' ] );
17 protected function getGroup( $groupDefinition ) {
18 return new MockChangesListFilterGroup(
20 'isFullCoverage' => true,
21 'type' => 'some_type',
28 // @codingStandardsIgnoreStart
30 * @expectedException MWException
31 * @expectedExceptionMessage Filter names may not contain '_'. Use the naming convention: 'lowercase'
33 // @codingStandardsIgnoreEnd
34 public function testReservedCharacter() {
35 $filter = new MockChangesListFilter(
37 'group' => $this->group
,
38 'name' => 'some_name',
44 // @codingStandardsIgnoreStart
46 * @expectedException MWException
47 * @expectedExceptionMessage Two filters in a group cannot have the same name: 'somename'
49 // @codingStandardsIgnoreEnd
50 public function testDuplicateName() {
51 new MockChangesListFilter(
53 'group' => $this->group
,
59 new MockChangesListFilter(
61 'group' => $this->group
,
69 * @expectedException MWException
70 * @expectedExceptionMessage Supersets can only be defined for filters in the same group
72 public function testSetAsSupersetOf() {
73 $groupA = $this->getGroup(
87 $groupB = $this->getGroup(
98 $foo = TestingAccessWrapper
::newFromObject( $groupA->getFilter( 'foo' ) );
100 $bar = $groupA->getFilter( 'bar' );
102 $baz = $groupB->getFilter( 'baz' );
104 $foo->setAsSupersetOf( $bar );
105 $this->assertArrayEquals( [
112 /** ordered= */ false,
116 $foo->setAsSupersetOf( $baz );