4 * @covers ChangesListFilter
6 class ChangesListFilterTest
extends MediaWikiTestCase
{
9 public function setUp() {
10 $this->group
= $this->getGroup( [ 'name' => 'group' ] );
15 protected function getGroup( $groupDefinition ) {
16 return new MockChangesListFilterGroup(
18 'isFullCoverage' => true,
19 'type' => 'some_type',
27 // @codingStandardsIgnoreStart
29 * @expectedException MWException
30 * @expectedExceptionMessage Filter names may not contain '_'. Use the naming convention: 'lowercase'
32 // @codingStandardsIgnoreEnd
33 public function testReservedCharacter() {
34 $filter = new MockChangesListFilter(
36 'group' => $this->group
,
37 'name' => 'some_name',
43 // @codingStandardsIgnoreStart
45 * @expectedException MWException
46 * @expectedExceptionMessage Two filters in a group cannot have the same name: 'somename'
48 // @codingStandardsIgnoreEnd
49 public function testDuplicateName() {
50 new MockChangesListFilter(
52 'group' => $this->group
,
58 new MockChangesListFilter(
60 'group' => $this->group
,
68 * @expectedException MWException
69 * @expectedExceptionMessage Supersets can only be defined for filters in the same group
71 public function testSetAsSupersetOf() {
72 $groupA = $this->getGroup(
86 $groupB = $this->getGroup(
97 $foo = TestingAccessWrapper
::newFromObject( $groupA->getFilter( 'foo' ) );
99 $bar = $groupA->getFilter( 'bar' );
101 $baz = $groupB->getFilter( 'baz' );
103 $foo->setAsSupersetOf( $bar );
104 $this->assertArrayEquals( [
111 /** ordered= */ false,
115 $foo->setAsSupersetOf( $baz );