]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Tests/Helper/RuleBasedTaggerTest.php
Convert array + phpDoc
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Tests / Helper / RuleBasedTaggerTest.php
index cddc8b086276a95f8cba4bb31cf444c345248f17..e9025b450df58b16b1cf97010ae561e0ef96cdce 100644 (file)
@@ -6,8 +6,8 @@ use Wallabag\CoreBundle\Entity\Config;
 use Wallabag\CoreBundle\Entity\Entry;
 use Wallabag\CoreBundle\Entity\Tag;
 use Wallabag\CoreBundle\Entity\TaggingRule;
-use Wallabag\UserBundle\Entity\User;
 use Wallabag\CoreBundle\Helper\RuleBasedTagger;
+use Wallabag\UserBundle\Entity\User;
 
 class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
 {
@@ -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,11 +94,10 @@ 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();
-        $tag->setLabel('foo');
 
         $this->rulerz
             ->expects($this->once())
@@ -118,13 +117,13 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
         $this->assertFalse($entry->getTags()->isEmpty());
 
         $tags = $entry->getTags();
-        $this->assertSame($tag->getLabel(), $tags[0]->getLabel());
+        $this->assertSame($tag, $tags[0]);
     }
 
     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);
@@ -143,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]);
 
@@ -153,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);