From: Jeremy Benoist Date: Thu, 23 Jun 2016 09:47:46 +0000 (+0200) Subject: Merge branch 'master' into 2.1 X-Git-Tag: 2.1.0~70 X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=f49d9ca383c9f8a1bc426cfabf6b1cea53ea26b4;hp=49e2854d5c15bbce3f24f91da34450e8f209295b;p=github%2Fwallabag%2Fwallabag.git Merge branch 'master' into 2.1 --- diff --git a/.travis.yml b/.travis.yml index 0e72d207..17c3abaf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -67,6 +67,6 @@ before_install: script: - travis_wait bash install.sh - ant prepare-$DB - - bin/phpunit -v + - phpunit -v - if [ "$CS_FIXER" = "run" ]; then php bin/php-cs-fixer fix src/ --verbose --dry-run ; fi; - if [ "$VALIDATE_TRANSLATION_FILE" = "run" ]; then php bin/console lint:yaml src/Wallabag/CoreBundle/Resources/translations -v ; fi; diff --git a/app/config/config.yml b/app/config/config.yml index c371cf73..29847820 100644 --- a/app/config/config.yml +++ b/app/config/config.yml @@ -156,7 +156,7 @@ liip_theme: path_patterns: bundle_resource: - - %%bundle_path%%/Resources/views/themes/%%current_theme%%/%%template%% + - "%%bundle_path%%/Resources/views/themes/%%current_theme%%/%%template%%" fos_user: db_driver: orm @@ -164,9 +164,9 @@ fos_user: user_class: Wallabag\UserBundle\Entity\User registration: confirmation: - enabled: %fosuser_confirmation% + enabled: "%fosuser_confirmation%" from_email: - address: %from_email% + address: "%from_email%" sender_name: wallabag fos_oauth_server: db_driver: orm @@ -184,8 +184,8 @@ scheb_two_factor: cookie_lifetime: 2592000 email: - enabled: %twofactor_auth% - sender_email: %twofactor_sender% + enabled: "%twofactor_auth%" + sender_email: "%twofactor_sender%" digits: 6 template: WallabagUserBundle:Authentication:form.html.twig mailer: wallabag_user.auth_code_mailer diff --git a/app/config/config_dev.yml b/app/config/config_dev.yml index 410d5a6c..f3030ff1 100644 --- a/app/config/config_dev.yml +++ b/app/config/config_dev.yml @@ -17,14 +17,14 @@ monolog: type: stream path: "%kernel.logs_dir%/%kernel.environment%.log" level: debug - channels: [!event] + channels: ['!event'] console: type: console bubble: false verbosity_levels: VERBOSITY_VERBOSE: INFO VERBOSITY_VERY_VERBOSE: DEBUG - channels: [!event, !doctrine] + channels: ['!event', '!doctrine'] console_very_verbose: type: console bubble: false diff --git a/app/config/config_prod.yml b/app/config/config_prod.yml index 342837a0..65b040cc 100644 --- a/app/config/config_prod.yml +++ b/app/config/config_prod.yml @@ -2,8 +2,8 @@ imports: - { resource: config.yml } #framework: -# validation: -# cache: apc +# cache: +# system: cache.adapter.apcu #doctrine: # orm: diff --git a/bin/phpunit b/bin/phpunit deleted file mode 120000 index 4ba32564..00000000 --- a/bin/phpunit +++ /dev/null @@ -1 +0,0 @@ -../vendor/phpunit/phpunit/phpunit \ No newline at end of file diff --git a/composer.json b/composer.json index a8ab2a59..7beb9bd9 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,7 @@ "ext-iconv": "*", "ext-tokenizer": "*", "ext-pdo": "*", - "symfony/symfony": "3.0.*", + "symfony/symfony": "3.1.*", "doctrine/orm": "^2.5", "doctrine/doctrine-bundle": "^1.6", "doctrine/doctrine-cache-bundle": "^1.2", @@ -85,9 +85,10 @@ }, "require-dev": { "doctrine/doctrine-fixtures-bundle": "~2.2", + "doctrine/data-fixtures": "~1.1.1", "sensio/generator-bundle": "^3.0", "phpunit/phpunit": "~4.4", - "symfony/phpunit-bridge": "^2.7", + "symfony/phpunit-bridge": "^3.0", "friendsofphp/php-cs-fixer": "~1.9" }, "scripts": { @@ -119,6 +120,9 @@ "psr-4": { "Wallabag\\": "src/Wallabag/" }, "classmap": [ "app/AppKernel.php", "app/AppCache.php" ] }, + "autoload-dev": { + "psr-4": { "Tests\\": "tests/" } + }, "config": { "bin-dir": "bin" }, diff --git a/phpunit.xml.dist b/phpunit.xml.dist index e68df9de..38880908 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,24 +1,20 @@ - +> - src/Wallabag/*Bundle/Tests + tests + diff --git a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php index 4cf22200..74c53bf0 100644 --- a/src/Wallabag/CoreBundle/Form/Type/ConfigType.php +++ b/src/Wallabag/CoreBundle/Form/Type/ConfigType.php @@ -32,7 +32,6 @@ class ConfigType extends AbstractType $builder ->add('theme', ChoiceType::class, [ 'choices' => array_flip($this->themes), - 'choices_as_values' => true, 'label' => 'config.form_settings.theme_label', ]) ->add('items_per_page', null, [ @@ -49,7 +48,6 @@ class ConfigType extends AbstractType ]) ->add('language', ChoiceType::class, [ 'choices' => array_flip($this->languages), - 'choices_as_values' => true, 'label' => 'config.form_settings.language_label', ]) ->add('save', SubmitType::class, [ diff --git a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php index f3f848e9..3c597b5d 100644 --- a/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php +++ b/src/Wallabag/CoreBundle/Form/Type/EntryFilterType.php @@ -36,17 +36,26 @@ class EntryFilterType extends AbstractType $builder ->add('readingTime', NumberRangeFilterType::class, [ 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { - $value = $values['value']; + $lower = $values['value']['left_number'][0]; + $upper = $values['value']['right_number'][0]; + + $min = (int) ($lower * $this->user->getConfig()->getReadingSpeed()); + $max = (int) ($upper * $this->user->getConfig()->getReadingSpeed()); - if (null === $value['left_number'][0] || null === $value['right_number'][0]) { + if (null === $lower && null === $upper) { + // no value? no filter return; + } elseif (null === $lower && null !== $upper) { + // only lower value is defined: query all entries with reading LOWER THAN this value + $expression = $filterQuery->getExpr()->lte($field, $max); + } elseif (null !== $lower && null === $upper) { + // only upper value is defined: query all entries with reading GREATER THAN this value + $expression = $filterQuery->getExpr()->gte($field, $min); + } else { + // both value are defined, perform a between + $expression = $filterQuery->getExpr()->between($field, $min, $max); } - $min = (int) ($value['left_number'][0] * $this->user->getConfig()->getReadingSpeed()); - $max = (int) ($value['right_number'][0] * $this->user->getConfig()->getReadingSpeed()); - - $expression = $filterQuery->getExpr()->between($field, $min, $max); - return $filterQuery->createCondition($expression); }, 'label' => 'entry.filters.reading_time.label', @@ -113,7 +122,6 @@ class EntryFilterType extends AbstractType ]) ->add('language', ChoiceFilterType::class, [ 'choices' => array_flip($this->repository->findDistinctLanguageByUser($this->user->getId())), - 'choices_as_values' => true, 'label' => 'entry.filters.language_label', ]) ; diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml index 9fc8ca2a..94300596 100644 --- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml +++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml @@ -268,12 +268,12 @@ quickstart: tagging_rules: 'Écrivez des règles pour classer automatiquement vos articles' admin: title: 'Administration' - description: "En tant qu'adminitrasteur sur wallabag, vous avez des privilèges qui vous permette de :" + description: "En tant qu'administrateur sur wallabag, vous avez des privilèges qui vous permettent de :" new_user: 'Créer un nouvel utilisateur' analytics: 'Configurer les statistiques' sharing: 'Activer des paramètres de partages' - export: 'Configurer les export' - import: 'Configurer les import' + export: "Configurer les formats d'export" + import: "Configurer l'import" first_steps: title: 'Premiers pas' new_article: 'Ajoutez votre premier article' @@ -289,7 +289,7 @@ quickstart: create_application: 'Créer votre application tierce' docs: title: 'Documentation complète' - annotate: 'Annotater votre article' + annotate: 'Annoter votre article' export: 'Convertissez vos articles en ePub ou en PDF' search_filters: "Apprenez à utiliser le moteur de recherche et les filtres pour retrouver l'article qui vous intéresse" fetching_errors: "Que faire si mon article n'est pas correctement récupéré ?" diff --git a/src/Wallabag/AnnotationBundle/Tests/Controller/AnnotationControllerTest.php b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php similarity index 97% rename from src/Wallabag/AnnotationBundle/Tests/Controller/AnnotationControllerTest.php rename to tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php index 3eba7193..70849f74 100644 --- a/src/Wallabag/AnnotationBundle/Tests/Controller/AnnotationControllerTest.php +++ b/tests/Wallabag/AnnotationBundle/Controller/AnnotationControllerTest.php @@ -1,8 +1,8 @@ assertCount(1, $crawler->filter('div[class=entry]')); } + public function testFilterOnReadingTimeOnlyUpper() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/unread/list'); + + $form = $crawler->filter('button[id=submit-filter]')->form(); + + $data = [ + 'entry_filter[readingTime][right_number]' => 22, + ]; + + $crawler = $client->submit($form, $data); + + $this->assertCount(2, $crawler->filter('div[class=entry]')); + } + + public function testFilterOnReadingTimeOnlyLower() + { + $this->logInAs('admin'); + $client = $this->getClient(); + + $crawler = $client->request('GET', '/unread/list'); + + $form = $crawler->filter('button[id=submit-filter]')->form(); + + $data = [ + 'entry_filter[readingTime][left_number]' => 22, + ]; + + $crawler = $client->submit($form, $data); + + $this->assertCount(4, $crawler->filter('div[class=entry]')); + } + public function testFilterOnUnreadStatus() { $this->logInAs('admin'); diff --git a/src/Wallabag/CoreBundle/Tests/Controller/ExportControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php similarity index 98% rename from src/Wallabag/CoreBundle/Tests/Controller/ExportControllerTest.php rename to tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php index 76c98055..b22156c3 100644 --- a/src/Wallabag/CoreBundle/Tests/Controller/ExportControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php @@ -1,8 +1,8 @@ unregister(); -$apcLoader->register(true); -*/ - $kernel = new AppKernel('prod', false); $kernel->loadClassCache(); //$kernel = new AppCache($kernel);