]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
improve test and change method name. Also, display number of entries for each tag 1663/head
authorThomas Citharel <tcit@tcit.fr>
Wed, 10 Feb 2016 17:40:15 +0000 (18:40 +0100)
committerThomas Citharel <tcit@tcit.fr>
Wed, 10 Feb 2016 17:40:15 +0000 (18:40 +0100)
src/Wallabag/CoreBundle/Repository/TagRepository.php
src/Wallabag/CoreBundle/Resources/views/themes/material/Tag/tags.html.twig
src/Wallabag/CoreBundle/Tests/Controller/TagControllerTest.php

index 8d9cf85cef14677ff66077f8b057d62acc257257..afeb985b30c272c9b9f76d84540b15eaf230f172 100644 (file)
@@ -57,7 +57,7 @@ class TagRepository extends EntityRepository
      *
      * @return Tag
      */
-    public function findOnebyEntryAndLabel($entry, $label)
+    public function findOneByEntryAndTagLabel($entry, $label)
     {
         return $this->createQueryBuilder('t')
             ->leftJoin('t.entries', 'e')
index 9f92c1789ac549861f278faa341a6a80c604e0ae..19754d415d7818a9799ccd750af982e4a99d134a 100644 (file)
@@ -9,7 +9,7 @@
     <br />
     <ul class="row data">
     {% for tag in tags %}
-        <li id="tag-{{ tag.id|e }}" class="col l4 m6 s12">{{tag.label}}</li>
+        <li id="tag-{{ tag.id|e }}" class="col l4 m6 s12">{{tag.label}} ({{ tag.entries.getValues | length }})</li>
     {% endfor %}
     </ul>
 {% endblock %}
index ae29a2a68383016de785d2957fee8b6c83dcae7a..d639128224f60a149cb6989ffafd1f305ea85316 100644 (file)
@@ -81,12 +81,14 @@ class TagControllerTest extends WallabagCoreTestCase
         $tag = $client->getContainer()
             ->get('doctrine.orm.entity_manager')
             ->getRepository('WallabagCoreBundle:Tag')
-            ->findOnebyEntryAndLabel($entry, $this->tagName);
+            ->findOneByEntryAndTagLabel($entry, $this->tagName);
 
         $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId());
 
         $this->assertEquals(302, $client->getResponse()->getStatusCode());
 
+        $this->assertNotContains($this->tagName, $entry->getTags());
+
         $client->request('GET', '/remove-tag/'.$entry->getId().'/'.$tag->getId());
 
         $this->assertEquals(404, $client->getResponse()->getStatusCode());