Merge remote-tracking branch 'origin/master' into 2.1

This commit is contained in:
Jeremy Benoist 2016-07-20 12:02:02 +02:00
commit 0faeabefa7
26 changed files with 149 additions and 64 deletions

3
.gitignore vendored
View file

@ -10,6 +10,9 @@
/var/sessions/*
!var/sessions/.gitkeep
!var/SymfonyRequirements.php
/bin/*
!/bin/console
!/bin/symfony_requirements
# Parameters
/app/config/parameters.yml

View file

@ -23,6 +23,7 @@ php:
- 5.5
- 5.6
- 7.0
- nightly
- hhvm
node_js:

View file

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

View file

@ -5,17 +5,19 @@ imports:
framework:
#esi: ~
translator: { fallback: "%locale%" }
translator:
enabled: true
fallback: "%locale%"
secret: "%secret%"
router:
resource: "%kernel.root_dir%/config/routing.yml"
strict_requirements: ~
form: ~
csrf_protection: ~
validation: { enable_annotations: true }
validation:
enable_annotations: true
templating:
engines: ['twig']
#assets_version: SomeVersionScheme
default_locale: "%locale%"
trusted_hosts: ~
trusted_proxies: ~
@ -98,7 +100,8 @@ swiftmailer:
host: "%mailer_host%"
username: "%mailer_user%"
password: "%mailer_password%"
spool: { type: memory }
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:

View 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

View file

@ -8,7 +8,9 @@ security:
providers:
administrators:
entity: { class: WallabagUserBundle:User, property: username }
entity:
class: WallabagUserBundle:User
property: username
fos_userbundle:
id: fos_user.user_provider.username

View file

@ -1 +0,0 @@
../vendor/doctrine/orm/bin/doctrine

View file

@ -1 +0,0 @@
../vendor/doctrine/dbal/bin/doctrine-dbal

View file

@ -1 +0,0 @@
../vendor/doctrine/migrations/bin/doctrine-migrations

View file

@ -1 +0,0 @@
../vendor/doctrine/orm/bin/doctrine.php

View file

@ -1 +0,0 @@
../vendor/friendsofphp/php-cs-fixer/php-cs-fixer

View file

@ -1 +0,0 @@
../vendor/sensiolabs/security-checker/security-checker

View file

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

View 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",

View 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:

View 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 :

View 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'

View file

@ -129,10 +129,10 @@
<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>

View 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]);

View 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

View 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();

View 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]);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB