Skip to content

Commit

Permalink
added array_unique to avoid duplicated entries (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
wachterjohannes authored and trickreich committed Feb 5, 2018
1 parent 77e66d9 commit fdbf942
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 1 addition & 3 deletions GoneSubscriber/GoneDocumentSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ public function createRedirects(RemoveEvent $event)
}

/**
* @param BasePageDocument $docum ent
*
* @return array
*/
protected function getUrls(BasePageDocument $document)
Expand Down Expand Up @@ -165,7 +163,7 @@ protected function getUrls(BasePageDocument $document)
$url = parse_url($url, PHP_URL_PATH);
}

return $urls;
return array_unique($urls);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Tests/Unit/GoneSubscriber/GoneDocumentSubscriberTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ protected function setUp()
$this->webspaceManager = $this->prophesize(WebspaceManager::class);
$this->webspaceManager->findWebspaceByKey('example')->willReturn($this->webspace->reveal());
$this->webspaceManager->findUrlsByResourceLocator('/article', 'test', 'en')
->willReturn(['http://{host}/en/article']);
->willReturn(['http://{host}/en/article', 'http://sulu.io/en/article']);
$this->webspaceManager->findUrlsByResourceLocator('/article1', 'test', 'en')
->willReturn(['http://{host}/en/article1']);
$this->webspaceManager->findUrlsByResourceLocator('/article2', 'test', 'en')
Expand Down

0 comments on commit fdbf942

Please sign in to comment.