aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJerome Charaoui <jerome@riseup.net>2016-12-06 22:17:44 -0500
committerJeremy Benoist <jbenoist@20minutes.fr>2017-06-01 09:43:01 +0200
commit7aba665e484c5c36ee029219a999a427d864ff22 (patch)
tree9ac57748d91cee32848b5e961e293e1c9a1fa61f /tests
parent2a0eec07a5630401a9ceb7add65604f79238f10c (diff)
downloadwallabag-7aba665e484c5c36ee029219a999a427d864ff22.tar.gz
wallabag-7aba665e484c5c36ee029219a999a427d864ff22.tar.zst
wallabag-7aba665e484c5c36ee029219a999a427d864ff22.zip
Avoid returning objects passed by reference.
Objects are always passed by reference, so it doesn't make sense to return an object which is passed by reference as it will always be the same object. This change makes the code a bit more readable.
Diffstat (limited to 'tests')
-rw-r--r--tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php30
1 files changed, 19 insertions, 11 deletions
diff --git a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
index 0c715d90..16643938 100644
--- a/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
+++ b/tests/Wallabag/CoreBundle/Helper/ContentProxyTest.php
@@ -38,7 +38,8 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
38 ]); 38 ]);
39 39
40 $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage); 40 $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage);
41 $entry = $proxy->updateEntry(new Entry(new User()), 'http://user@:80'); 41 $entry = new Entry(new User());
42 $proxy->updateEntry($entry, 'http://user@:80');
42 43
43 $this->assertEquals('http://user@:80', $entry->getUrl()); 44 $this->assertEquals('http://user@:80', $entry->getUrl());
44 $this->assertEmpty($entry->getTitle()); 45 $this->assertEmpty($entry->getTitle());
@@ -72,7 +73,8 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
72 ]); 73 ]);
73 74
74 $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage); 75 $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage);
75 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); 76 $entry = new Entry(new User());
77 $proxy->updateEntry($entry, 'http://0.0.0.0');
76 78
77 $this->assertEquals('http://0.0.0.0', $entry->getUrl()); 79 $this->assertEquals('http://0.0.0.0', $entry->getUrl());
78 $this->assertEmpty($entry->getTitle()); 80 $this->assertEmpty($entry->getTitle());
@@ -111,7 +113,8 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
111 ]); 113 ]);
112 114
113 $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage); 115 $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage);
114 $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io'); 116 $entry = new Entry(new User());
117 $proxy->updateEntry($entry, 'http://domain.io');
115 118
116 $this->assertEquals('http://domain.io', $entry->getUrl()); 119 $this->assertEquals('http://domain.io', $entry->getUrl());
117 $this->assertEquals('my title', $entry->getTitle()); 120 $this->assertEquals('my title', $entry->getTitle());
@@ -152,7 +155,8 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
152 ]); 155 ]);
153 156
154 $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage); 157 $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage);
155 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); 158 $entry = new Entry(new User());
159 $proxy->updateEntry($entry, 'http://0.0.0.0');
156 160
157 $this->assertEquals('http://1.1.1.1', $entry->getUrl()); 161 $this->assertEquals('http://1.1.1.1', $entry->getUrl());
158 $this->assertEquals('this is my title', $entry->getTitle()); 162 $this->assertEquals('this is my title', $entry->getTitle());
@@ -213,8 +217,9 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
213 ->method('tag'); 217 ->method('tag');
214 218
215 $proxy = new ContentProxy((new Graby()), $tagger, $this->getLogger(), $this->fetchingErrorMessage); 219 $proxy = new ContentProxy((new Graby()), $tagger, $this->getLogger(), $this->fetchingErrorMessage);
216 $entry = $proxy->updateEntry( 220 $entry = new Entry(new User());
217 new Entry(new User()), 221 $proxy->updateEntry(
222 $entry,
218 'http://0.0.0.0', 223 'http://0.0.0.0',
219 [ 224 [
220 'html' => str_repeat('this is my content', 325), 225 'html' => str_repeat('this is my content', 325),
@@ -251,8 +256,9 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
251 ->method('tag'); 256 ->method('tag');
252 257
253 $proxy = new ContentProxy((new Graby()), $tagger, $this->getLogger(), $this->fetchingErrorMessage); 258 $proxy = new ContentProxy((new Graby()), $tagger, $this->getLogger(), $this->fetchingErrorMessage);
254 $entry = $proxy->updateEntry( 259 $entry = new Entry(new User());
255 new Entry(new User()), 260 $proxy->updateEntry(
261 $entry,
256 'http://0.0.0.0', 262 'http://0.0.0.0',
257 [ 263 [
258 'html' => str_repeat('this is my content', 325), 264 'html' => str_repeat('this is my content', 325),
@@ -285,8 +291,9 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
285 $logger->pushHandler($handler); 291 $logger->pushHandler($handler);
286 292
287 $proxy = new ContentProxy((new Graby()), $tagger, $logger, $this->fetchingErrorMessage); 293 $proxy = new ContentProxy((new Graby()), $tagger, $logger, $this->fetchingErrorMessage);
288 $entry = $proxy->updateEntry( 294 $entry = new Entry(new User());
289 new Entry(new User()), 295 $proxy->updateEntry(
296 $entry,
290 'http://0.0.0.0', 297 'http://0.0.0.0',
291 [ 298 [
292 'html' => str_repeat('this is my content', 325), 299 'html' => str_repeat('this is my content', 325),
@@ -326,7 +333,8 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
326 333
327 $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage); 334 $proxy = new ContentProxy($graby, $tagger, $this->getLogger(), $this->fetchingErrorMessage);
328 335
329 $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0', [ 336 $entry = new Entry(new User());
337 $proxy->updateEntry($entry, 'http://0.0.0.0', [
330 'html' => str_repeat('this is my content', 325), 338 'html' => str_repeat('this is my content', 325),
331 'title' => 'this is my title', 339 'title' => 'this is my title',
332 'url' => 'http://1.1.1.1', 340 'url' => 'http://1.1.1.1',