]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Merge remote-tracking branch 'origin/master' into 2.1
authorJeremy Benoist <jeremy.benoist@gmail.com>
Wed, 20 Jul 2016 10:02:02 +0000 (12:02 +0200)
committerJeremy Benoist <jeremy.benoist@gmail.com>
Wed, 20 Jul 2016 10:02:02 +0000 (12:02 +0200)
26 files changed:
.gitignore
.travis.yml
README.md
app/config/config.yml
app/config/config_dev.yml
app/config/config_prod.yml
app/config/routing.yml
app/config/routing_dev.yml
app/config/security.yml
bin/doctrine [deleted symlink]
bin/doctrine-dbal [deleted symlink]
bin/doctrine-migrations [deleted symlink]
bin/doctrine.php [deleted symlink]
bin/php-cs-fixer [deleted symlink]
bin/security-checker [deleted symlink]
bin/symfony_requirements
composer.json
docs/en/user/installation.rst
docs/fr/user/installation.rst
src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig
tests/Wallabag/CoreBundle/Controller/SecurityControllerTest.php
tests/Wallabag/CoreBundle/Controller/TagControllerTest.php
tests/Wallabag/CoreBundle/WallabagCoreTestCase.php
tests/Wallabag/ImportBundle/Controller/PocketControllerTest.php
tests/Wallabag/ImportBundle/fixtures/unnamed.png [new file with mode: 0644]

index 5eca0e6b2f7f85e723397a01bcc95d6c7722fe00..fb51034e28110d62921deddf00cbacaf6eb85358 100644 (file)
@@ -10,6 +10,9 @@
 /var/sessions/*
 !var/sessions/.gitkeep
 !var/SymfonyRequirements.php
+/bin/*
+!/bin/console
+!/bin/symfony_requirements
 
 # Parameters
 /app/config/parameters.yml
index 17c3abafc6fc325458438c4434c010dcc0e1a705..dd8815c13cd2808f579e3149db9532c66cb67119 100644 (file)
@@ -23,6 +23,7 @@ php:
     - 5.5
     - 5.6
     - 7.0
+    - nightly
     - hhvm
 
 node_js:
index 2a7b54bf78b89aa793ecf652d2044e1e26cf204f..0d87d7bb332210eb6bfe09f418d86297a60f11f1 100644 (file)
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ More informations on our website: [wallabag.org](https://wallabag.org)
 
 # Install wallabag
 
-If you don't have it yet, please [install composer](https://getcomposer.org/download/).
+If you don't have it yet, please [install composer](https://getcomposer.org/download/) or be sure to use Composer 1.2 (`composer selfupdate` can help you about that).
 Then you can install wallabag by executing the following commands:
 
 ```
index 298478203fea90740431406b023a7ab004fa9196..a1517e974eff46a3004344b50518448e421847fc 100644 (file)
@@ -5,25 +5,27 @@ imports:
 
 framework:
     #esi:             ~
-    translator:      { fallback: "%locale%" }
-    secret:          "%secret%"
+    translator:
+        enabled: true
+        fallback: "%locale%"
+    secret: "%secret%"
     router:
         resource: "%kernel.root_dir%/config/routing.yml"
         strict_requirements: ~
-    form:            ~
+    form: ~
     csrf_protection: ~
-    validation:      { enable_annotations: true }
+    validation:
+        enable_annotations: true
     templating:
         engines: ['twig']
-        #assets_version: SomeVersionScheme
-    default_locale:  "%locale%"
-    trusted_hosts:   ~
+    default_locale: "%locale%"
+    trusted_hosts: ~
     trusted_proxies: ~
     session:
         # handler_id set to null will use default session handler from php.ini
-        handler_id:  session.handler.native_file
-        save_path:   "%kernel.root_dir%/../var/sessions/%kernel.environment%"
-    fragments:       ~
+        handler_id: session.handler.native_file
+        save_path: "%kernel.root_dir%/../var/sessions/%kernel.environment%"
+    fragments: ~
     http_method_override: true
     assets: ~
 
@@ -54,7 +56,7 @@ wallabag_import:
 
 # Twig Configuration
 twig:
-    debug:            "%kernel.debug%"
+    debug: "%kernel.debug%"
     strict_variables: "%kernel.debug%"
     form_themes:
         - "LexikFormFilterBundle:Form:form_div_layout.html.twig"
@@ -62,14 +64,14 @@ twig:
 # Doctrine Configuration
 doctrine:
     dbal:
-        driver:   "%database_driver%"
+        driver: "%database_driver%"
         host: "%database_host%"
         port: "%database_port%"
         dbname: "%database_name%"
         user: "%database_user%"
         password: "%database_password%"
-        charset:  UTF8
-        path:     "%database_path%"
+        charset: UTF8
+        path: "%database_path%"
         server_version: 5.6
 
     orm:
@@ -95,10 +97,11 @@ doctrine_migrations:
 # Swiftmailer Configuration
 swiftmailer:
     transport: "%mailer_transport%"
-    host:      "%mailer_host%"
-    username:  "%mailer_user%"
-    password:  "%mailer_password%"
-    spool:     { type: memory }
+    host: "%mailer_host%"
+    username: "%mailer_user%"
+    password: "%mailer_password%"
+    spool:
+        type: memory
 
 fos_rest:
     param_fetcher_listener: true
@@ -160,7 +163,7 @@ liip_theme:
 
 fos_user:
     db_driver: orm
-    firewall_name: main
+    firewall_name: secured_area
     user_class: Wallabag\UserBundle\Entity\User
     registration:
         confirmation:
index f3030ff1620eb3a249e8fc0bb40d36340c09947d..77840682dfb273d0fac99a5d3ad40190e498ac59 100644 (file)
@@ -5,7 +5,8 @@ framework:
     router:
         resource: "%kernel.root_dir%/config/routing_dev.yml"
         strict_requirements: true
-    profiler: { only_exceptions: false }
+    profiler:
+        only_exceptions: false
 
 web_profiler:
     toolbar: true
@@ -14,19 +15,19 @@ web_profiler:
 monolog:
     handlers:
         main:
-            type:   stream
-            path:   "%kernel.logs_dir%/%kernel.environment%.log"
-            level:  debug
+            type: stream
+            path: "%kernel.logs_dir%/%kernel.environment%.log"
+            level: debug
             channels: ['!event']
         console:
-            type:   console
+            type: console
             bubble: false
             verbosity_levels:
                 VERBOSITY_VERBOSE: INFO
                 VERBOSITY_VERY_VERBOSE: DEBUG
             channels: ['!event', '!doctrine']
         console_very_verbose:
-            type:   console
+            type: console
             bubble: false
             verbosity_levels:
                 VERBOSITY_VERBOSE: NOTICE
index 65b040ccef91420386eee74d097791774f1644f8..5a4dd69e265887d0b03878ffee6528962c25be7f 100644 (file)
@@ -14,12 +14,12 @@ imports:
 monolog:
     handlers:
         main:
-            type:         fingers_crossed
+            type: fingers_crossed
             action_level: error
-            handler:      nested
+            handler: nested
         nested:
-            type:  stream
-            path:  "%kernel.logs_dir%/%kernel.environment%.log"
+            type: stream
+            path: "%kernel.logs_dir%/%kernel.environment%.log"
             level: debug
         console:
-            type:  console
+            type: console
index 6a6aa6aca65ff3763cbde25a0bda56305a934ea4..40cc7165bb4e410f175a330fa591e2f79ea70e59 100644 (file)
@@ -4,8 +4,8 @@ wallabag_annotation:
 
 wallabag_import:
     resource: "@WallabagImportBundle/Controller/"
-    type:     annotation
-    prefix:   /import
+    type: annotation
+    prefix: /import
 
 wallabag_api:
     resource: "@WallabagApiBundle/Resources/config/routing.yml"
index 404f6a3bce570a6acda8720e6d53b6845afd0a01..95c1b0263cc08396d6905e2acf6d38b48dd2c454 100644 (file)
@@ -1,14 +1,14 @@
 _wdt:
     resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
-    prefix:   /_wdt
+    prefix: /_wdt
 
 _profiler:
     resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
-    prefix:   /_profiler
+    prefix: /_profiler
 
 _errors:
     resource: "@TwigBundle/Resources/config/routing/errors.xml"
-    prefix:   /_error
+    prefix: /_error
 
 _main:
     resource: routing.yml
index 0748c06ce03d316c67e5237541718569d95caa9a..e24e03df2e921d98eff8325b86a1ae2733a8ea6d 100644 (file)
@@ -3,12 +3,14 @@ security:
         FOS\UserBundle\Model\UserInterface: sha512
 
     role_hierarchy:
-        ROLE_ADMIN:       ROLE_USER
+        ROLE_ADMIN: ROLE_USER
         ROLE_SUPER_ADMIN: [ ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH ]
 
     providers:
         administrators:
-            entity: { class: WallabagUserBundle:User, property: username }
+            entity:
+                class: WallabagUserBundle:User
+                property: username
         fos_userbundle:
             id: fos_user.user_provider.username
 
@@ -31,7 +33,7 @@ security:
             anonymous: true
 
         login_firewall:
-            pattern:    ^/login$
+            pattern: ^/login$
             anonymous:  ~
 
         secured_area:
@@ -40,12 +42,12 @@ security:
                 provider: fos_userbundle
                 csrf_token_generator: security.csrf.token_manager
 
-            anonymous:    true
+            anonymous: true
             remember_me:
-                secret:   "%secret%"
+                secret: "%secret%"
                 lifetime: 31536000
-                path:     /
-                domain:   ~
+                path: /
+                domain: ~
 
             logout:
                 path:   /logout
diff --git a/bin/doctrine b/bin/doctrine
deleted file mode 120000 (symlink)
index 0f72e36..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../vendor/doctrine/orm/bin/doctrine
\ No newline at end of file
diff --git a/bin/doctrine-dbal b/bin/doctrine-dbal
deleted file mode 120000 (symlink)
index 110e93c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../vendor/doctrine/dbal/bin/doctrine-dbal
\ No newline at end of file
diff --git a/bin/doctrine-migrations b/bin/doctrine-migrations
deleted file mode 120000 (symlink)
index 7184da7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../vendor/doctrine/migrations/bin/doctrine-migrations
\ No newline at end of file
diff --git a/bin/doctrine.php b/bin/doctrine.php
deleted file mode 120000 (symlink)
index b22b74d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../vendor/doctrine/orm/bin/doctrine.php
\ No newline at end of file
diff --git a/bin/php-cs-fixer b/bin/php-cs-fixer
deleted file mode 120000 (symlink)
index 4d77120..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../vendor/friendsofphp/php-cs-fixer/php-cs-fixer
\ No newline at end of file
diff --git a/bin/security-checker b/bin/security-checker
deleted file mode 120000 (symlink)
index 85f6e8e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-../vendor/sensiolabs/security-checker/security-checker
\ No newline at end of file
index 7cd559a4517cb0c85fcca8ef3d81b7a143f98f5a..8825a964676ae774fab136ca2670799ec64a415d 100755 (executable)
@@ -13,7 +13,7 @@ echo '> PHP is using the following php.ini file:'.PHP_EOL;
 if ($iniPath) {
     echo_style('green', '  '.$iniPath);
 } else {
-    echo_style('warning', '  WARNING: No configuration file (php.ini) used by PHP!');
+    echo_style('yellow', '  WARNING: No configuration file (php.ini) used by PHP!');
 }
 
 echo PHP_EOL.PHP_EOL;
index 7beb9bd92f74ed663634fe5c8ebff1fe007b7088..38ccec81b042d77679456bda3073a2e34044a48f 100644 (file)
@@ -73,7 +73,7 @@
         "grandt/phpepub": "~4.0",
         "wallabag/php-mobi": "~1.0.0",
         "kphoen/rulerz-bundle": "~0.10",
-        "guzzlehttp/guzzle": "^5.2.0",
+        "guzzlehttp/guzzle": "^5.3.1",
         "doctrine/doctrine-migrations-bundle": "^1.0",
         "paragonie/random_compat": "~1.0",
         "craue/config-bundle": "~1.4",
index 58d9fb7e0a80078ff9f13b28064e9b208e3a999a..bd3095e03752d55e630c74a6f215decc03f55803 100644 (file)
@@ -37,7 +37,7 @@ Installation
 On a dedicated web server (recommended way)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-wallabag uses a large number of libraries in order to function. These libraries must be installed with a tool called Composer. You need to install it if you have not already done so.
+wallabag uses a large number of libraries in order to function. These libraries must be installed with a tool called Composer. You need to install it if you have not already done so and be sure to use the 1.2 version (if you already have Composer, run a ``composer selfupdate``).
 
 Install Composer:
 
index b1136c12b33853c89f1b669135966c0f7f638c15..0693fc5d33542782a274dcd0e0f5c43556a4df0c 100644 (file)
@@ -35,7 +35,7 @@ Installation
 Sur un serveur dédié (méthode conseillée)
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
-wallabag utilise un grand nombre de bibliothèques pour fonctionner. Ces bibliothèques doivent être installées à l'aide d'un outil nommé Composer. Vous devez l'installer si ce n'est déjà fait.
+wallabag utilise un grand nombre de bibliothèques pour fonctionner. Ces bibliothèques doivent être installées à l'aide d'un outil nommé Composer. Vous devez l'installer si ce n'est déjà fait et vous assurer que vous utilisez bien la version 1.2 (si vous avez déjà Composer, faite un ``composer selfupdate``).
 
 Installation de Composer :
 
index f3fa44f1dafeb43fcaeb73aa3c492d563ab1c354..5a755e6c095bbc655708e015dd7171ca83144f58 100644 (file)
@@ -135,7 +135,7 @@ config:
 
 entry:
     page_titles:
-        unread: 'Artúclos no leídos'
+        unread: 'Artículos no leídos'
         starred: 'Artículos favoritos'
         archived: 'Artículos archivados'
         filtered: 'Artículos filtrados'
index ed0ad2f6d34039a95a7ba1b8e7981356ade83c0e..563820969c42f1c92fa50e2956cdda3c2f6f4c5b 100644 (file)
                         <a target="_blank" class="grey-text text-lighten-3" href="https://itunes.apple.com/app/id828331015" title="iOS">
                             <span class="icon-apple"></span>
                         </a>
-                        <a target="_blank" class="grey-text text-lighten-3" href="https://addons.mozilla.org/firefox/addon/wallabag/" title="Firefox">
+                        <a target="_blank" class="grey-text text-lighten-3" href="https://addons.mozilla.org/firefox/addon/wallabag-v2/" title="Firefox">
                             <span class="icon-firefox"></span>
                         </a>
-                        <a target="_blank" class="grey-text text-lighten-3" href="https://chrome.google.com/webstore/detail/wallabagit/peehlcgckcnclnjlndmoddifcicdnabm" title="Chrome">
+                        <a target="_blank" class="grey-text text-lighten-3" href="https://chrome.google.com/webstore/detail/wallabagger/gbmgphmejlcoihgedabhgjdkcahacjlj" title="Chrome">
                             <span class="icon-chrome"></span>
                         </a>
                     </p>
index f503ff4bd8daff2bd2d64209d643d2d0e231d410..03355f5abde2d02820ea5ce842c8938dccbe8dda 100644 (file)
@@ -36,7 +36,7 @@ class SecurityControllerTest extends WallabagCoreTestCase
         $em->persist($user);
         $em->flush();
 
-        $this->logInAs('admin');
+        $this->logInAsUsingHttp('admin');
         $crawler = $client->request('GET', '/config');
         $this->assertContains('scheb_two_factor.trusted', $crawler->filter('body')->extract(['_text'])[0]);
 
index a019d36c98c24cfb20882cd4d0e0f7e8f010fe81..58450e5fb0933632480e8a7c60e6c30a20efc7a3 100644 (file)
@@ -39,6 +39,12 @@ class TagControllerTest extends WallabagCoreTestCase
         $client->submit($form, $data);
         $this->assertEquals(302, $client->getResponse()->getStatusCode());
 
+        // be sure to reload the entry
+        $entry = $client->getContainer()
+            ->get('doctrine.orm.entity_manager')
+            ->getRepository('WallabagCoreBundle:Entry')
+            ->findOneByUsernameAndNotArchived('admin');
+
         $this->assertEquals(1, count($entry->getTags()));
 
         # tag already exists and already assigned
index c69e83301203ec577c9eb23577afaa8e09a8adbc..c0055888a255eaa44aa88d52f5630ff50e5c6147 100644 (file)
@@ -3,6 +3,7 @@
 namespace Tests\Wallabag\CoreBundle;
 
 use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
+use Symfony\Component\BrowserKit\Cookie;
 
 abstract class WallabagCoreTestCase extends WebTestCase
 {
@@ -20,7 +21,38 @@ abstract class WallabagCoreTestCase extends WebTestCase
         $this->client = static::createClient();
     }
 
+    /**
+     * Login a user without making a HTTP request.
+     * If we make a HTTP request we lose ability to mock service in the container.
+     *
+     * @param string $username User to log in
+     */
     public function logInAs($username)
+    {
+        $container = $this->client->getContainer();
+        $session = $container->get('session');
+
+        $userManager = $container->get('fos_user.user_manager');
+        $loginManager = $container->get('fos_user.security.login_manager');
+        $firewallName = $container->getParameter('fos_user.firewall_name');
+
+        $user = $userManager->findUserBy(array('username' => $username));
+        $loginManager->loginUser($firewallName, $user);
+
+        $session->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken()));
+        $session->save();
+
+        $cookie = new Cookie($session->getName(), $session->getId());
+        $this->client->getCookieJar()->set($cookie);
+    }
+
+    /**
+     * Instead of `logInAs` this method use a HTTP request to log in the user.
+     * Could be better for some tests.
+     *
+     * @param string $username User to log in
+     */
+    public function logInAsUsingHttp($username)
     {
         $crawler = $this->client->request('GET', '/login');
         $form = $crawler->filter('button[type=submit]')->form();
index 6aaf1b57be7a1d00ef2ea0600b2ebbb82a217c51..e0e61df88c43d5d5161128a261738bf9385c0e69 100644 (file)
@@ -22,15 +22,13 @@ class PocketControllerTest extends WallabagCoreTestCase
         $this->logInAs('admin');
         $client = $this->getClient();
 
-        $crawler = $client->request('GET', '/import/pocket/auth');
+        $client->request('GET', '/import/pocket/auth');
 
         $this->assertEquals(302, $client->getResponse()->getStatusCode());
     }
 
     public function testImportPocketAuth()
     {
-        $this->markTestSkipped('PocketImport: Find a way to properly mock a service.');
-
         $this->logInAs('admin');
         $client = $this->getClient();
 
@@ -43,9 +41,9 @@ class PocketControllerTest extends WallabagCoreTestCase
             ->method('getRequestToken')
             ->willReturn('token');
 
-        $client->getContainer()->set('wallabag_import.pocket.import', $pocketImport);
+        static::$kernel->getContainer()->set('wallabag_import.pocket.import', $pocketImport);
 
-        $crawler = $client->request('GET', '/import/pocket/auth');
+        $client->request('GET', '/import/pocket/auth');
 
         $this->assertEquals(301, $client->getResponse()->getStatusCode());
         $this->assertContains('getpocket.com/auth/authorize', $client->getResponse()->headers->get('location'));
@@ -56,10 +54,55 @@ class PocketControllerTest extends WallabagCoreTestCase
         $this->logInAs('admin');
         $client = $this->getClient();
 
-        $crawler = $client->request('GET', '/import/pocket/callback');
+        $pocketImport = $this->getMockBuilder('Wallabag\ImportBundle\Import\PocketImport')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $pocketImport
+            ->expects($this->once())
+            ->method('authorize')
+            ->willReturn(false);
+
+        static::$kernel->getContainer()->set('wallabag_import.pocket.import', $pocketImport);
+
+        $client->request('GET', '/import/pocket/callback');
 
         $this->assertEquals(302, $client->getResponse()->getStatusCode());
-        $this->assertContains('import/pocket', $client->getResponse()->headers->get('location'));
+        $this->assertContains('/', $client->getResponse()->headers->get('location'), 'Import is ok, redirect to homepage');
         $this->assertEquals('flashes.import.notice.failed', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]);
     }
+
+    public function testImportPocketCallback()
+    {
+        $this->logInAs('admin');
+        $client = $this->getClient();
+
+        $pocketImport = $this->getMockBuilder('Wallabag\ImportBundle\Import\PocketImport')
+            ->disableOriginalConstructor()
+            ->getMock();
+
+        $pocketImport
+            ->expects($this->once())
+            ->method('authorize')
+            ->willReturn(true);
+
+        $pocketImport
+            ->expects($this->once())
+            ->method('setMarkAsRead')
+            ->with(false)
+            ->willReturn($pocketImport);
+
+        $pocketImport
+            ->expects($this->once())
+            ->method('import')
+            ->willReturn(true);
+
+        static::$kernel->getContainer()->set('wallabag_import.pocket.import', $pocketImport);
+
+        $client->request('GET', '/import/pocket/callback');
+
+        $this->assertEquals(302, $client->getResponse()->getStatusCode());
+        $this->assertContains('/', $client->getResponse()->headers->get('location'), 'Import is ok, redirect to homepage');
+        $this->assertEquals('flashes.import.notice.summary', $client->getContainer()->get('session')->getFlashBag()->peek('notice')[0]);
+    }
 }
diff --git a/tests/Wallabag/ImportBundle/fixtures/unnamed.png b/tests/Wallabag/ImportBundle/fixtures/unnamed.png
new file mode 100644 (file)
index 0000000..e6dd9ca
Binary files /dev/null and b/tests/Wallabag/ImportBundle/fixtures/unnamed.png differ