Skip to content

Commit

Permalink
[automated] Re-Apply Rector Rules (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
addwiki-ci committed Apr 10, 2021
1 parent c268a19 commit 571ed37
Showing 1 changed file with 12 additions and 14 deletions.
26 changes: 12 additions & 14 deletions tests/integration/Service/CategoryTraverserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,12 @@ protected function setUp(): void {
}

/**
* A convenience wrapper around a PageDeleter.
* @param string[] $titles The titles to delete.
* A convenience wrapper to blank pages.
* TODO actually delete them?
* @param string[] $titles The titles to blank.
*/
public function deletePages( array $titles ): void {
$deleter = $this->factory->newPageDeleter();
public function blankPages( array $titles ): void {
foreach ( $titles as $t ) {
// @todo Properly delete?
// $deleter->deleteFromPageTitle( new Title( $t ) );
$this->savePage( $t, '' );
}
}
Expand Down Expand Up @@ -80,7 +78,7 @@ public function testDescendants(): void {
$this->traverser->addCallback( CategoryTraverser::CALLBACK_PAGE, $callback );
$decendants = $this->traverser->descend( $rootCat );
$this->assertCount( 4, $decendants->toArray() );
$this->deletePages( [
$this->blankPages( [
'Category:Root category',
'Category:Sub category B',
'Category:Sub category C',
Expand All @@ -106,7 +104,7 @@ public function testDescendantsWithMultiplePaths(): void {
$this->testEnvironment->runJobs();
$decendants = $this->traverser->descend( $grandparent );
$this->assertCount( 4, $decendants->toArray() );
$this->deletePages( [
$this->blankPages( [
'Category:Grandparent',
'Category:Parent 1',
'Category:Parent 2',
Expand Down Expand Up @@ -145,7 +143,7 @@ public function testDescendantsOnlyVisitCatsOnce(): void {
$descendants = $this->traverser->descend( $catA );
$this->assertCount( 0, $descendants->toArray() );
$this->assertCount( 3, $wgVisitedCats );
$this->deletePages( [
$this->blankPages( [
'Category:A cat',
'Category:B cat',
'Category:C cat',
Expand All @@ -167,10 +165,10 @@ public function testDescendantsOnlyVisitCatsOnce(): void {
*/
public function testDescendIntoLoop(): void {
$catA = $this->savePage( 'Category:E cat', '[[Category:H cat]]' );
$catB = $this->savePage( 'Category:F cat', '[[Category:E cat]]' );
$catC = $this->savePage( 'Category:G cat', '[[Category:E cat]]' );
$catD = $this->savePage( 'Category:H cat', '[[Category:F cat]]' );
$catE = $this->savePage( 'Category:I cat', '[[Category:F cat]]' );
$this->savePage( 'Category:F cat', '[[Category:E cat]]' );
$this->savePage( 'Category:G cat', '[[Category:E cat]]' );
$this->savePage( 'Category:H cat', '[[Category:F cat]]' );
$this->savePage( 'Category:I cat', '[[Category:F cat]]' );
$this->testEnvironment->runJobs();
$haveCaught = false;
try {
Expand All @@ -191,7 +189,7 @@ public function testDescendIntoLoop(): void {
$this->assertEquals( $expectedCatLoop, $actualCatLoop );
}
$this->assertTrue( $haveCaught );
$this->deletePages( [
$this->blankPages( [
'Category:E cat',
'Category:F cat',
'Category:G cat',
Expand Down

0 comments on commit 571ed37

Please sign in to comment.