Merge branch 'master' into 2.1

This commit is contained in:
Jeremy Benoist 2016-06-23 11:47:46 +02:00
commit f49d9ca383
54 changed files with 133 additions and 102 deletions

View file

@ -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;

View file

@ -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

View file

@ -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

View file

@ -2,8 +2,8 @@ imports:
- { resource: config.yml }
#framework:
# validation:
# cache: apc
# cache:
# system: cache.adapter.apcu
#doctrine:
# orm:

View file

@ -1 +0,0 @@
../vendor/phpunit/phpunit/phpunit

View file

@ -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"
},

View file

@ -1,24 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.8/phpunit.xsd"
backupGlobals="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="app/autoload.php"
>
>
<testsuites>
<testsuite name="wallabag Test Suite">
<directory>src/Wallabag/*Bundle/Tests</directory>
<directory>tests</directory>
</testsuite>
</testsuites>
<php>
<ini name="error_reporting" value="-1" />
<server name="KERNEL_DIR" value="app/" />
</php>

View file

@ -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, [

View file

@ -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];
if (null === $value['left_number'][0] || null === $value['right_number'][0]) {
$min = (int) ($lower * $this->user->getConfig()->getReadingSpeed());
$max = (int) ($upper * $this->user->getConfig()->getReadingSpeed());
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',
])
;

View file

@ -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é ?"

View file

@ -1,8 +1,8 @@
<?php
namespace Wallabag\AnnotationBundle\Tests\Controller;
namespace Tests\AnnotationBundle\Controller;
use Wallabag\AnnotationBundle\Tests\WallabagAnnotationTestCase;
use Tests\Wallabag\AnnotationBundle\WallabagAnnotationTestCase;
class AnnotationControllerTest extends WallabagAnnotationTestCase
{

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\AnnotationBundle\Tests;
namespace Tests\Wallabag\AnnotationBundle;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\BrowserKit\Cookie;

View file

@ -1,8 +1,8 @@
<?php
namespace Wallabag\ApiBundle\Tests\Controller;
namespace Tests\Wallabag\ApiBundle\Controller;
use Wallabag\ApiBundle\Tests\WallabagApiTestCase;
use Tests\Wallabag\ApiBundle\WallabagApiTestCase;
class WallabagRestControllerTest extends WallabagApiTestCase
{

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\ApiBundle\Tests;
namespace Tests\Wallabag\ApiBundle;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Component\BrowserKit\Cookie;

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\CoreBundle\Tests\Command;
namespace Tests\Wallabag\CoreBundle\Command;
use Doctrine\Bundle\DoctrineBundle\Command\CreateDatabaseDoctrineCommand;
use Doctrine\Bundle\DoctrineBundle\Command\DropDatabaseDoctrineCommand;
@ -9,8 +9,8 @@ use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Console\Tester\CommandTester;
use Wallabag\CoreBundle\Command\InstallCommand;
use Wallabag\CoreBundle\Tests\Mock\InstallCommandMock;
use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
use Tests\Wallabag\CoreBundle\Mock\InstallCommandMock;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
class InstallCommandTest extends WallabagCoreTestCase
{

View file

@ -1,11 +1,11 @@
<?php
namespace Wallabag\CoreBundle\Tests\Command;
namespace Tests\Wallabag\CoreBundle\Command;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Component\Console\Tester\CommandTester;
use Wallabag\CoreBundle\Command\TagAllCommand;
use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
class TagAllCommandTest extends WallabagCoreTestCase
{

View file

@ -1,8 +1,8 @@
<?php
namespace Wallabag\CoreBundle\Tests\Controller;
namespace Tests\Wallabag\CoreBundle\Controller;
use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
class ConfigControllerTest extends WallabagCoreTestCase
{

View file

@ -1,8 +1,8 @@
<?php
namespace Wallabag\CoreBundle\Tests\Controller;
namespace Tests\Wallabag\CoreBundle\Controller;
use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
class DeveloperControllerTest extends WallabagCoreTestCase
{

View file

@ -1,8 +1,8 @@
<?php
namespace Wallabag\CoreBundle\Tests\Controller;
namespace Tests\Wallabag\CoreBundle\Controller;
use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
use Wallabag\CoreBundle\Entity\Entry;
class EntryControllerTest extends WallabagCoreTestCase
@ -499,6 +499,42 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->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');

View file

@ -1,8 +1,8 @@
<?php
namespace Wallabag\CoreBundle\Tests\Controller;
namespace Tests\Wallabag\CoreBundle\Controller;
use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
class ExportControllerTest extends WallabagCoreTestCase
{

View file

@ -1,8 +1,8 @@
<?php
namespace Wallabag\CoreBundle\Tests\Controller;
namespace Tests\Wallabag\CoreBundle\Controller;
use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
class RssControllerTest extends WallabagCoreTestCase
{

View file

@ -1,8 +1,8 @@
<?php
namespace Wallabag\CoreBundle\Tests\Controller;
namespace Tests\Wallabag\CoreBundle\Controller;
use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
class SecurityControllerTest extends WallabagCoreTestCase
{

View file

@ -1,8 +1,8 @@
<?php
namespace Wallabag\CoreBundle\Tests\Controller;
namespace Tests\Wallabag\CoreBundle\Controller;
use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
/**
* The controller `SettingsController` does not exist.

View file

@ -1,8 +1,8 @@
<?php
namespace Wallabag\CoreBundle\Tests\Controller;
namespace Tests\Wallabag\CoreBundle\Controller;
use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
class StaticControllerTest extends WallabagCoreTestCase
{

View file

@ -1,8 +1,8 @@
<?php
namespace Wallabag\CoreBundle\Tests\Controller;
namespace Tests\Wallabag\CoreBundle\Controller;
use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
class TagControllerTest extends WallabagCoreTestCase
{

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\CoreBundle\Tests\EventListener;
namespace Tests\Wallabag\CoreBundle\EventListener;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\HttpFoundation\Request;

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\CoreBundle\Tests\EventListener;
namespace Tests\Wallabag\CoreBundle\EventListener;
use FOS\UserBundle\Event\FilterUserResponseEvent;
use FOS\UserBundle\FOSUserEvents;

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\CoreBundle\Tests\EventListener;
namespace Tests\Wallabag\CoreBundle\EventListener;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Session\Session;

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\CoreBundle\Tests\Form\DataTransformer;
namespace Tests\Wallabag\CoreBundle\Form\DataTransformer;
use Wallabag\CoreBundle\Form\DataTransformer\StringToListTransformer;

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\CoreBundle\Tests\Helper;
namespace Tests\Wallabag\CoreBundle\Helper;
use Psr\Log\NullLogger;
use Wallabag\CoreBundle\Helper\ContentProxy;

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\CoreBundle\Tests\Helper;
namespace Tests\Wallabag\CoreBundle\Helper;
use Wallabag\CoreBundle\Helper\Redirect;

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\CoreBundle\Tests\Helper;
namespace Tests\Wallabag\CoreBundle\Helper;
use Wallabag\CoreBundle\Entity\Config;
use Wallabag\CoreBundle\Entity\Entry;

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\CoreBundle\Tests\Mock;
namespace Tests\Wallabag\CoreBundle\Mock;
use Wallabag\CoreBundle\Command\InstallCommand;

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\CoreBundle\Tests\Command;
namespace Tests\Wallabag\CoreBundle\Command;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Component\HttpFoundation\Request;

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\CoreBundle\Tests\Subscriber;
namespace Tests\Wallabag\CoreBundle\Subscriber;
use Doctrine\Common\EventManager;
use Doctrine\ORM\Event\LoadClassMetadataEventArgs;

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\CoreBundle\Tests\Twig;
namespace Tests\Wallabag\CoreBundle\Twig;
use Wallabag\CoreBundle\Twig\WallabagExtension;

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\CoreBundle\Tests;
namespace Tests\Wallabag\CoreBundle;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

View file

@ -1,8 +1,8 @@
<?php
namespace Wallabag\ImportBundle\Tests\Controller;
namespace Tests\Wallabag\ImportBundle\Controller;
use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
class ImportControllerTest extends WallabagCoreTestCase
{

View file

@ -1,8 +1,8 @@
<?php
namespace Wallabag\ImportBundle\Tests\Controller;
namespace Tests\Wallabag\ImportBundle\Controller;
use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
class PocketControllerTest extends WallabagCoreTestCase
{

View file

@ -1,8 +1,8 @@
<?php
namespace Wallabag\ImportBundle\Tests\Controller;
namespace Tests\Wallabag\ImportBundle\Controller;
use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
use Symfony\Component\HttpFoundation\File\UploadedFile;
class WallabagV1ControllerTest extends WallabagCoreTestCase

View file

@ -1,8 +1,8 @@
<?php
namespace Wallabag\ImportBundle\Tests\Controller;
namespace Tests\Wallabag\ImportBundle\Controller;
use Wallabag\CoreBundle\Tests\WallabagCoreTestCase;
use Tests\Wallabag\CoreBundle\WallabagCoreTestCase;
use Symfony\Component\HttpFoundation\File\UploadedFile;
class WallabagV2ControllerTest extends WallabagCoreTestCase

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\ImportBundle\Tests\Import;
namespace Tests\Wallabag\ImportBundle\Import;
use Wallabag\ImportBundle\Import\ImportChain;

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\ImportBundle\Tests\Import;
namespace Tests\Wallabag\ImportBundle\Import;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Wallabag\ImportBundle\Import\ImportCompilerPass;

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\ImportBundle\Tests\Import;
namespace Tests\Wallabag\ImportBundle\Import;
use Wallabag\UserBundle\Entity\User;
use Wallabag\CoreBundle\Entity\Entry;

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\ImportBundle\Tests\Import;
namespace Tests\Wallabag\ImportBundle\Import;
use Wallabag\ImportBundle\Import\WallabagV1Import;
use Wallabag\UserBundle\Entity\User;

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\ImportBundle\Tests\Import;
namespace Tests\Wallabag\ImportBundle\Import;
use Wallabag\ImportBundle\Import\WallabagV2Import;
use Wallabag\UserBundle\Entity\User;

View file

@ -1,6 +1,6 @@
<?php
namespace Wallabag\UserBundle\Tests\Mailer;
namespace Tests\Wallabag\UserBundle\Mailer;
use Wallabag\UserBundle\Entity\User;
use Wallabag\UserBundle\Mailer\AuthCodeMailer;

View file

@ -8,16 +8,6 @@ use Symfony\Component\HttpFoundation\Request;
$loader = require __DIR__.'/../app/autoload.php';
include_once __DIR__.'/../var/bootstrap.php.cache';
// Enable APC for autoloading to improve performance.
// You should change the ApcClassLoader first argument to a unique prefix
// in order to prevent cache key conflicts with other applications
// also using APC.
/*
$apcLoader = new Symfony\Component\ClassLoader\ApcClassLoader(sha1(__FILE__), $loader);
$loader->unregister();
$apcLoader->register(true);
*/
$kernel = new AppKernel('prod', false);
$kernel->loadClassCache();
//$kernel = new AppCache($kernel);