From 4094ea47712efbe58624ff74daeb1f77c9b0edcf Mon Sep 17 00:00:00 2001 From: Jeremy Benoist Date: Tue, 12 Apr 2016 11:36:01 +0200 Subject: Convert array + phpDoc Thanks for https://github.com/thomasbachem/php-short-array-syntax-converter --- .../CoreBundle/Tests/Helper/ContentProxyTest.php | 38 +++++++++++----------- .../Tests/Helper/RuleBasedTaggerTest.php | 18 +++++----- 2 files changed, 28 insertions(+), 28 deletions(-) (limited to 'src/Wallabag/CoreBundle/Tests/Helper') diff --git a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php index 74bfb054..9d7b0f36 100644 --- a/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php +++ b/src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php @@ -17,19 +17,19 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ->method('tag'); $graby = $this->getMockBuilder('Graby\Graby') - ->setMethods(array('fetchContent')) + ->setMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); $graby->expects($this->any()) ->method('fetchContent') - ->willReturn(array( + ->willReturn([ 'html' => false, 'title' => '', 'url' => '', 'content_type' => '', 'language' => '', - )); + ]); $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); $entry = $proxy->updateEntry(new Entry(new User()), 'http://user@:80'); @@ -51,19 +51,19 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ->method('tag'); $graby = $this->getMockBuilder('Graby\Graby') - ->setMethods(array('fetchContent')) + ->setMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); $graby->expects($this->any()) ->method('fetchContent') - ->willReturn(array( + ->willReturn([ 'html' => false, 'title' => '', 'url' => '', 'content_type' => '', 'language' => '', - )); + ]); $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); @@ -85,23 +85,23 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ->method('tag'); $graby = $this->getMockBuilder('Graby\Graby') - ->setMethods(array('fetchContent')) + ->setMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); $graby->expects($this->any()) ->method('fetchContent') - ->willReturn(array( + ->willReturn([ 'html' => false, 'title' => '', 'url' => '', 'content_type' => '', 'language' => '', - 'open_graph' => array( + 'open_graph' => [ 'og_title' => 'my title', 'og_description' => 'desc', - ), - )); + ], + ]); $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io'); @@ -123,24 +123,24 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase ->method('tag'); $graby = $this->getMockBuilder('Graby\Graby') - ->setMethods(array('fetchContent')) + ->setMethods(['fetchContent']) ->disableOriginalConstructor() ->getMock(); $graby->expects($this->any()) ->method('fetchContent') - ->willReturn(array( + ->willReturn([ 'html' => str_repeat('this is my content', 325), 'title' => 'this is my title', 'url' => 'http://1.1.1.1', 'content_type' => 'text/html', 'language' => 'fr', - 'open_graph' => array( + 'open_graph' => [ 'og_title' => 'my OG title', 'og_description' => 'OG desc', 'og_image' => 'http://3.3.3.3/cover.jpg', - ), - )); + ], + ]); $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); @@ -217,7 +217,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase $entry = new Entry(new User()); - $proxy->assignTagsToEntry($entry, array(' tag1', 'tag2 ')); + $proxy->assignTagsToEntry($entry, [' tag1', 'tag2 ']); $this->assertCount(2, $entry->getTags()); $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); @@ -253,7 +253,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase $entry = new Entry(new User()); - $proxy->assignTagsToEntry($entry, array()); + $proxy->assignTagsToEntry($entry, []); $this->assertCount(0, $entry->getTags()); } @@ -299,7 +299,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase private function getTaggerMock() { return $this->getMockBuilder('Wallabag\CoreBundle\Helper\RuleBasedTagger') - ->setMethods(array('tag')) + ->setMethods(['tag']) ->disableOriginalConstructor() ->getMock(); } diff --git a/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php b/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php index c43c62c3..e9025b45 100644 --- a/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php +++ b/src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php @@ -36,7 +36,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase public function testTagWithNoMatchingRule() { - $taggingRule = $this->getTaggingRule('rule as string', array('foo', 'bar')); + $taggingRule = $this->getTaggingRule('rule as string', ['foo', 'bar']); $user = $this->getUser([$taggingRule]); $entry = new Entry($user); @@ -53,7 +53,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase public function testTagWithAMatchingRule() { - $taggingRule = $this->getTaggingRule('rule as string', array('foo', 'bar')); + $taggingRule = $this->getTaggingRule('rule as string', ['foo', 'bar']); $user = $this->getUser([$taggingRule]); $entry = new Entry($user); @@ -74,8 +74,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase public function testTagWithAMixOfMatchingRules() { - $taggingRule = $this->getTaggingRule('bla bla', array('hey')); - $otherTaggingRule = $this->getTaggingRule('rule as string', array('foo')); + $taggingRule = $this->getTaggingRule('bla bla', ['hey']); + $otherTaggingRule = $this->getTaggingRule('rule as string', ['foo']); $user = $this->getUser([$taggingRule, $otherTaggingRule]); $entry = new Entry($user); @@ -94,7 +94,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase public function testWhenTheTagExists() { - $taggingRule = $this->getTaggingRule('rule as string', array('foo')); + $taggingRule = $this->getTaggingRule('rule as string', ['foo']); $user = $this->getUser([$taggingRule]); $entry = new Entry($user); $tag = new Tag(); @@ -122,8 +122,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase public function testSameTagWithDifferentfMatchingRules() { - $taggingRule = $this->getTaggingRule('bla bla', array('hey')); - $otherTaggingRule = $this->getTaggingRule('rule as string', array('hey')); + $taggingRule = $this->getTaggingRule('bla bla', ['hey']); + $otherTaggingRule = $this->getTaggingRule('rule as string', ['hey']); $user = $this->getUser([$taggingRule, $otherTaggingRule]); $entry = new Entry($user); @@ -142,7 +142,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase public function testTagAllEntriesForAUser() { - $taggingRule = $this->getTaggingRule('bla bla', array('hey')); + $taggingRule = $this->getTaggingRule('bla bla', ['hey']); $user = $this->getUser([$taggingRule]); @@ -152,7 +152,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase $this->rulerz ->method('filter') - ->willReturn(array(new Entry($user), new Entry($user))); + ->willReturn([new Entry($user), new Entry($user)]); $entries = $this->tagger->tagAllForUser($user); -- cgit v1.2.3