]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge pull request #3047 from wallabag/add-notmatches-operator
authorNicolas LÅ“uillet <nicolas@loeuillet.org>
Wed, 3 May 2017 09:53:01 +0000 (11:53 +0200)
committerGitHub <noreply@github.com>
Wed, 3 May 2017 09:53:01 +0000 (11:53 +0200)
Added notmatches operator for tagging rule

1  2 
src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
tests/Wallabag/ApiBundle/Controller/EntryRestControllerTest.php

index 42a12b2a7b5035f75f2159995bf61d63c0eb5554,29f9938cf424b44b2c370ada19a7d403ba3e817c..4b74568304aa8a8078b407475a8b7dd354417879
@@@ -155,6 -155,7 +155,7 @@@ config
                  or: 'One rule OR another'
                  and: 'One rule AND another'
                  matches: 'Tests that a <i>subject</i> is matches a <i>search</i> (case-insensitive).<br />Example: <code>title matches "football"</code>'
+                 notmatches: 'Tests that a <i>subject</i> is not matches a <i>search</i> (case-insensitive).<br />Example: <code>title notmatches "football"</code>'
  
  entry:
      page_titles:
@@@ -361,7 -362,7 +362,7 @@@ quickstart
      developer:
          title: 'Developers'
          description: 'We also thought to the developers: Docker, API, translations, etc.'
 -        create_application: 'Create your third application'
 +        create_application: 'Create your third-party application'
          use_docker: 'Use Docker to install wallabag'
      docs:
          title: 'Full documentation'
index 19fb51707a0272d1290089e1c6884c081708a9da,d9acacfce479c9177c6fa89656819b9e62213de1..e6ffd6641a319f6575f2ce41fbbd6729e09ecc1f
@@@ -298,7 -298,7 +298,7 @@@ class EntryRestControllerTest extends W
          $entry = $this->client->getContainer()
              ->get('doctrine.orm.entity_manager')
              ->getRepository('WallabagCoreBundle:Entry')
 -            ->findOneByUser(1);
 +            ->findOneByUser(1, ['id' => 'asc']);
  
          if (!$entry) {
              $this->markTestSkipped('No content found in db.');
          $this->assertEquals(false, $content['is_starred']);
          $this->assertEquals('New title for my article', $content['title']);
          $this->assertEquals(1, $content['user_id']);
-         $this->assertCount(1, $content['tags']);
+         $this->assertCount(2, $content['tags']);
      }
  
      public function testPostSameEntry()
          $this->assertEquals('http://www.lemonde.fr/pixels/article/2015/03/28/plongee-dans-l-univers-d-ingress-le-jeu-de-google-aux-frontieres-du-reel_4601155_4408996.html', $content['url']);
          $this->assertEquals(true, $content['is_archived']);
          $this->assertEquals(false, $content['is_starred']);
-         $this->assertCount(2, $content['tags']);
+         $this->assertCount(3, $content['tags']);
      }
  
      public function testPostArchivedAndStarredEntry()
  
          $this->assertEquals('application/json', $this->client->getResponse()->headers->get('Content-Type'));
      }
 +
 +    public function testPostEntriesTagsListAction()
 +    {
 +        $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
 +            ->getRepository('WallabagCoreBundle:Entry')
 +            ->findByUrlAndUserId('http://0.0.0.0/entry4', 1);
 +
 +        $tags = $entry->getTags();
 +
 +        $this->assertCount(2, $tags);
 +
 +        $list = [
 +            [
 +                'url' => 'http://0.0.0.0/entry4',
 +                'tags' => 'new tag 1, new tag 2',
 +            ],
 +        ];
 +
 +        $this->client->request('POST', '/api/entries/tags/lists?list='.json_encode($list));
 +
 +        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
 +
 +        $content = json_decode($this->client->getResponse()->getContent(), true);
 +
 +        $this->assertInternalType('int', $content[0]['entry']);
 +        $this->assertEquals('http://0.0.0.0/entry4', $content[0]['url']);
 +
 +        $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
 +            ->getRepository('WallabagCoreBundle:Entry')
 +            ->findByUrlAndUserId('http://0.0.0.0/entry4', 1);
 +
 +        $tags = $entry->getTags();
 +        $this->assertCount(4, $tags);
 +    }
 +
 +    public function testDeleteEntriesTagsListAction()
 +    {
 +        $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
 +            ->getRepository('WallabagCoreBundle:Entry')
 +            ->findByUrlAndUserId('http://0.0.0.0/entry4', 1);
 +
 +        $tags = $entry->getTags();
 +
 +        $this->assertCount(4, $tags);
 +
 +        $list = [
 +            [
 +                'url' => 'http://0.0.0.0/entry4',
 +                'tags' => 'new tag 1, new tag 2',
 +            ],
 +        ];
 +
 +        $this->client->request('DELETE', '/api/entries/tags/list?list='.json_encode($list));
 +
 +        $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
 +
 +        $content = json_decode($this->client->getResponse()->getContent(), true);
 +
 +        $this->assertInternalType('int', $content[0]['entry']);
 +        $this->assertEquals('http://0.0.0.0/entry4', $content[0]['url']);
 +
 +        $entry = $this->client->getContainer()->get('doctrine.orm.entity_manager')
 +            ->getRepository('WallabagCoreBundle:Entry')
 +            ->findByUrlAndUserId('http://0.0.0.0/entry4', 1);
 +
 +        $tags = $entry->getTags();
 +        $this->assertCount(2, $tags);
 +    }
  }