aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Tests/Helper
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-04-12 11:36:01 +0200
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-04-12 12:25:29 +0200
commit4094ea47712efbe58624ff74daeb1f77c9b0edcf (patch)
tree3d2c168092d0208e6ba888de969252a54bf0c6c1 /src/Wallabag/CoreBundle/Tests/Helper
parent7eccbda99f16dc39ee01a0c81ab88293e9b268fd (diff)
downloadwallabag-4094ea47712efbe58624ff74daeb1f77c9b0edcf.tar.gz
wallabag-4094ea47712efbe58624ff74daeb1f77c9b0edcf.tar.zst
wallabag-4094ea47712efbe58624ff74daeb1f77c9b0edcf.zip
Convert array + phpDoc
Thanks for https://github.com/thomasbachem/php-short-array-syntax-converter
Diffstat (limited to 'src/Wallabag/CoreBundle/Tests/Helper')
-rw-r--r--src/Wallabag/CoreBundle/Tests/Helper/ContentProxyTest.php38
-rw-r--r--src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php18
2 files changed, 28 insertions, 28 deletions
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
17 ->method('tag'); 17 ->method('tag');
18 18
19 $graby = $this->getMockBuilder('Graby\Graby') 19 $graby = $this->getMockBuilder('Graby\Graby')
20 ->setMethods(array('fetchContent')) 20 ->setMethods(['fetchContent'])
21 ->disableOriginalConstructor() 21 ->disableOriginalConstructor()
22 ->getMock(); 22 ->getMock();
23 23
24 $graby->expects($this->any()) 24 $graby->expects($this->any())
25 ->method('fetchContent') 25 ->method('fetchContent')
26 ->willReturn(array( 26 ->willReturn([
27 'html' => false, 27 'html' => false,
28 'title' => '', 28 'title' => '',
29 'url' => '', 29 'url' => '',
30 'content_type' => '', 30 'content_type' => '',
31 'language' => '', 31 'language' => '',
32 )); 32 ]);
33 33
34 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); 34 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger());
35 $entry = $proxy->updateEntry(new Entry(new User()), 'http://user@:80'); 35 $entry = $proxy->updateEntry(new Entry(new User()), 'http://user@:80');
@@ -51,19 +51,19 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
51 ->method('tag'); 51 ->method('tag');
52 52
53 $graby = $this->getMockBuilder('Graby\Graby') 53 $graby = $this->getMockBuilder('Graby\Graby')
54 ->setMethods(array('fetchContent')) 54 ->setMethods(['fetchContent'])
55 ->disableOriginalConstructor() 55 ->disableOriginalConstructor()
56 ->getMock(); 56 ->getMock();
57 57
58 $graby->expects($this->any()) 58 $graby->expects($this->any())
59 ->method('fetchContent') 59 ->method('fetchContent')
60 ->willReturn(array( 60 ->willReturn([
61 'html' => false, 61 'html' => false,
62 'title' => '', 62 'title' => '',
63 'url' => '', 63 'url' => '',
64 'content_type' => '', 64 'content_type' => '',
65 'language' => '', 65 'language' => '',
66 )); 66 ]);
67 67
68 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); 68 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger());
69 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); 69 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0');
@@ -85,23 +85,23 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
85 ->method('tag'); 85 ->method('tag');
86 86
87 $graby = $this->getMockBuilder('Graby\Graby') 87 $graby = $this->getMockBuilder('Graby\Graby')
88 ->setMethods(array('fetchContent')) 88 ->setMethods(['fetchContent'])
89 ->disableOriginalConstructor() 89 ->disableOriginalConstructor()
90 ->getMock(); 90 ->getMock();
91 91
92 $graby->expects($this->any()) 92 $graby->expects($this->any())
93 ->method('fetchContent') 93 ->method('fetchContent')
94 ->willReturn(array( 94 ->willReturn([
95 'html' => false, 95 'html' => false,
96 'title' => '', 96 'title' => '',
97 'url' => '', 97 'url' => '',
98 'content_type' => '', 98 'content_type' => '',
99 'language' => '', 99 'language' => '',
100 'open_graph' => array( 100 'open_graph' => [
101 'og_title' => 'my title', 101 'og_title' => 'my title',
102 'og_description' => 'desc', 102 'og_description' => 'desc',
103 ), 103 ],
104 )); 104 ]);
105 105
106 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); 106 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger());
107 $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io'); 107 $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io');
@@ -123,24 +123,24 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
123 ->method('tag'); 123 ->method('tag');
124 124
125 $graby = $this->getMockBuilder('Graby\Graby') 125 $graby = $this->getMockBuilder('Graby\Graby')
126 ->setMethods(array('fetchContent')) 126 ->setMethods(['fetchContent'])
127 ->disableOriginalConstructor() 127 ->disableOriginalConstructor()
128 ->getMock(); 128 ->getMock();
129 129
130 $graby->expects($this->any()) 130 $graby->expects($this->any())
131 ->method('fetchContent') 131 ->method('fetchContent')
132 ->willReturn(array( 132 ->willReturn([
133 'html' => str_repeat('this is my content', 325), 133 'html' => str_repeat('this is my content', 325),
134 'title' => 'this is my title', 134 'title' => 'this is my title',
135 'url' => 'http://1.1.1.1', 135 'url' => 'http://1.1.1.1',
136 'content_type' => 'text/html', 136 'content_type' => 'text/html',
137 'language' => 'fr', 137 'language' => 'fr',
138 'open_graph' => array( 138 'open_graph' => [
139 'og_title' => 'my OG title', 139 'og_title' => 'my OG title',
140 'og_description' => 'OG desc', 140 'og_description' => 'OG desc',
141 'og_image' => 'http://3.3.3.3/cover.jpg', 141 'og_image' => 'http://3.3.3.3/cover.jpg',
142 ), 142 ],
143 )); 143 ]);
144 144
145 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); 145 $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger());
146 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); 146 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0');
@@ -217,7 +217,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
217 217
218 $entry = new Entry(new User()); 218 $entry = new Entry(new User());
219 219
220 $proxy->assignTagsToEntry($entry, array(' tag1', 'tag2 ')); 220 $proxy->assignTagsToEntry($entry, [' tag1', 'tag2 ']);
221 221
222 $this->assertCount(2, $entry->getTags()); 222 $this->assertCount(2, $entry->getTags());
223 $this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); 223 $this->assertEquals('tag1', $entry->getTags()[0]->getLabel());
@@ -253,7 +253,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
253 253
254 $entry = new Entry(new User()); 254 $entry = new Entry(new User());
255 255
256 $proxy->assignTagsToEntry($entry, array()); 256 $proxy->assignTagsToEntry($entry, []);
257 257
258 $this->assertCount(0, $entry->getTags()); 258 $this->assertCount(0, $entry->getTags());
259 } 259 }
@@ -299,7 +299,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
299 private function getTaggerMock() 299 private function getTaggerMock()
300 { 300 {
301 return $this->getMockBuilder('Wallabag\CoreBundle\Helper\RuleBasedTagger') 301 return $this->getMockBuilder('Wallabag\CoreBundle\Helper\RuleBasedTagger')
302 ->setMethods(array('tag')) 302 ->setMethods(['tag'])
303 ->disableOriginalConstructor() 303 ->disableOriginalConstructor()
304 ->getMock(); 304 ->getMock();
305 } 305 }
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
36 36
37 public function testTagWithNoMatchingRule() 37 public function testTagWithNoMatchingRule()
38 { 38 {
39 $taggingRule = $this->getTaggingRule('rule as string', array('foo', 'bar')); 39 $taggingRule = $this->getTaggingRule('rule as string', ['foo', 'bar']);
40 $user = $this->getUser([$taggingRule]); 40 $user = $this->getUser([$taggingRule]);
41 $entry = new Entry($user); 41 $entry = new Entry($user);
42 42
@@ -53,7 +53,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
53 53
54 public function testTagWithAMatchingRule() 54 public function testTagWithAMatchingRule()
55 { 55 {
56 $taggingRule = $this->getTaggingRule('rule as string', array('foo', 'bar')); 56 $taggingRule = $this->getTaggingRule('rule as string', ['foo', 'bar']);
57 $user = $this->getUser([$taggingRule]); 57 $user = $this->getUser([$taggingRule]);
58 $entry = new Entry($user); 58 $entry = new Entry($user);
59 59
@@ -74,8 +74,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
74 74
75 public function testTagWithAMixOfMatchingRules() 75 public function testTagWithAMixOfMatchingRules()
76 { 76 {
77 $taggingRule = $this->getTaggingRule('bla bla', array('hey')); 77 $taggingRule = $this->getTaggingRule('bla bla', ['hey']);
78 $otherTaggingRule = $this->getTaggingRule('rule as string', array('foo')); 78 $otherTaggingRule = $this->getTaggingRule('rule as string', ['foo']);
79 79
80 $user = $this->getUser([$taggingRule, $otherTaggingRule]); 80 $user = $this->getUser([$taggingRule, $otherTaggingRule]);
81 $entry = new Entry($user); 81 $entry = new Entry($user);
@@ -94,7 +94,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
94 94
95 public function testWhenTheTagExists() 95 public function testWhenTheTagExists()
96 { 96 {
97 $taggingRule = $this->getTaggingRule('rule as string', array('foo')); 97 $taggingRule = $this->getTaggingRule('rule as string', ['foo']);
98 $user = $this->getUser([$taggingRule]); 98 $user = $this->getUser([$taggingRule]);
99 $entry = new Entry($user); 99 $entry = new Entry($user);
100 $tag = new Tag(); 100 $tag = new Tag();
@@ -122,8 +122,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
122 122
123 public function testSameTagWithDifferentfMatchingRules() 123 public function testSameTagWithDifferentfMatchingRules()
124 { 124 {
125 $taggingRule = $this->getTaggingRule('bla bla', array('hey')); 125 $taggingRule = $this->getTaggingRule('bla bla', ['hey']);
126 $otherTaggingRule = $this->getTaggingRule('rule as string', array('hey')); 126 $otherTaggingRule = $this->getTaggingRule('rule as string', ['hey']);
127 127
128 $user = $this->getUser([$taggingRule, $otherTaggingRule]); 128 $user = $this->getUser([$taggingRule, $otherTaggingRule]);
129 $entry = new Entry($user); 129 $entry = new Entry($user);
@@ -142,7 +142,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
142 142
143 public function testTagAllEntriesForAUser() 143 public function testTagAllEntriesForAUser()
144 { 144 {
145 $taggingRule = $this->getTaggingRule('bla bla', array('hey')); 145 $taggingRule = $this->getTaggingRule('bla bla', ['hey']);
146 146
147 $user = $this->getUser([$taggingRule]); 147 $user = $this->getUser([$taggingRule]);
148 148
@@ -152,7 +152,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
152 152
153 $this->rulerz 153 $this->rulerz
154 ->method('filter') 154 ->method('filter')
155 ->willReturn(array(new Entry($user), new Entry($user))); 155 ->willReturn([new Entry($user), new Entry($user)]);
156 156
157 $entries = $this->tagger->tagAllForUser($user); 157 $entries = $this->tagger->tagAllForUser($user);
158 158