Merge pull request #1916 from wallabag/cleanup

Convert array + phpDoc
This commit is contained in:
Nicolas Lœuillet 2016-04-13 09:43:14 +02:00
commit f2e5fdc366
72 changed files with 636 additions and 684 deletions

View File

@ -1,5 +1,6 @@
imports: imports:
- { resource: config_dev.yml } - { resource: config_dev.yml }
- { resource: parameters_test.yml }
framework: framework:
test: ~ test: ~

View File

@ -19,14 +19,6 @@ parameters:
database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite" database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite"
database_table_prefix: wallabag_ database_table_prefix: wallabag_
test_database_driver: pdo_sqlite
test_database_host: 127.0.0.1
test_database_port: ~
test_database_name: ~
test_database_user: ~
test_database_password: ~
test_database_path: "%kernel.root_dir%/../data/db/wallabag_test.sqlite"
mailer_transport: smtp mailer_transport: smtp
mailer_host: 127.0.0.1 mailer_host: 127.0.0.1
mailer_user: ~ mailer_user: ~

View File

@ -0,0 +1,8 @@
parameters:
test_database_driver: pdo_sqlite
test_database_host: 127.0.0.1
test_database_port: null
test_database_name: null
test_database_user: null
test_database_password: null
test_database_path: '%kernel.root_dir%/../data/db/wallabag_testYO.sqlite'

View File

@ -1,37 +0,0 @@
# This file is a "template" of what your parameters.yml file should look like
parameters:
database_driver: pdo_sqlite
database_host: 127.0.0.1
database_port: ~
database_name: symfony
database_user: root
database_password: ~
database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite"
database_table_prefix: wallabag_
test_database_driver: pdo_mysql
test_database_host: localhost
test_database_port: 3306
test_database_name: wallabag_test
test_database_user: root
test_database_password: ~
test_database_path: ~
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: ~
mailer_password: ~
locale: en
# A secret key that's used to generate certain security-related tokens
secret: ThisTokenIsNotSoSecretChangeIt
# two factor stuff
twofactor_auth: true
twofactor_sender: no-reply@wallabag.org
# fosuser stuff
fosuser_confirmation: true
from_email: no-reply@wallabag.org

View File

@ -1,37 +0,0 @@
# This file is a "template" of what your parameters.yml file should look like
parameters:
database_driver: pdo_sqlite
database_host: 127.0.0.1
database_port: ~
database_name: symfony
database_user: root
database_password: ~
database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite"
database_table_prefix: wallabag_
test_database_driver: pdo_pgsql
test_database_host: localhost
test_database_port:
test_database_name: wallabag_test
test_database_user: travis
test_database_password: ~
test_database_path: ~
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: ~
mailer_password: ~
locale: en
# A secret key that's used to generate certain security-related tokens
secret: ThisTokenIsNotSoSecretChangeIt
# two factor stuff
twofactor_auth: true
twofactor_sender: no-reply@wallabag.org
# fosuser stuff
fosuser_confirmation: true
from_email: no-reply@wallabag.org

View File

@ -1,37 +0,0 @@
# This file is a "template" of what your parameters.yml file should look like
parameters:
database_driver: pdo_sqlite
database_host: 127.0.0.1
database_port: ~
database_name: symfony
database_user: root
database_password: ~
database_path: "%kernel.root_dir%/../data/db/wallabag.sqlite"
database_table_prefix: wallabag_
test_database_driver: pdo_sqlite
test_database_host: localhost
test_database_port:
test_database_name: ~
test_database_user: ~
test_database_password: ~
test_database_path: "%kernel.root_dir%/../data/db/wallabag_test.sqlite"
mailer_transport: smtp
mailer_host: 127.0.0.1
mailer_user: ~
mailer_password: ~
locale: en
# A secret key that's used to generate certain security-related tokens
secret: ThisTokenIsNotSoSecretChangeIt
# two factor stuff
twofactor_auth: true
twofactor_sender: no-reply@wallabag.org
# fosuser stuff
fosuser_confirmation: true
from_email: no-reply@wallabag.org

View File

@ -0,0 +1,8 @@
parameters:
test_database_driver: pdo_mysql
test_database_host: localhost
test_database_port: 3306
test_database_name: wallabag_test
test_database_user: root
test_database_password: ~
test_database_path: ~

View File

@ -0,0 +1,8 @@
parameters:
test_database_driver: pdo_pgsql
test_database_host: localhost
test_database_port:
test_database_name: wallabag_test
test_database_user: travis
test_database_password: ~
test_database_path: ~

View File

@ -0,0 +1,8 @@
parameters:
test_database_driver: pdo_sqlite
test_database_host: localhost
test_database_port:
test_database_name: ~
test_database_user: ~
test_database_password: ~
test_database_path: "%kernel.root_dir%/../data/db/wallabag_testHU.sqlite"

View File

@ -42,8 +42,8 @@
<target name="db_mysql" description="Run test for MySQL"> <target name="db_mysql" description="Run test for MySQL">
<delete dir="${basedir}/app/config/parameters.yml"/> <delete dir="${basedir}/app/config/parameters.yml"/>
<exec executable="cp"> <exec executable="cp">
<arg value="${basedir}/app/config/tests/parameters.yml.dist.mysql"/> <arg value="${basedir}/app/config/tests/parameters_test.mysql.yml"/>
<arg value="${basedir}/app/config/parameters.yml"/> <arg value="${basedir}/app/config/parameters_test.yml"/>
</exec> </exec>
<exec executable="php"> <exec executable="php">
@ -56,8 +56,8 @@
<target name="db_sqlite" description="Run test for SQLite"> <target name="db_sqlite" description="Run test for SQLite">
<delete dir="${basedir}/app/config/parameters.yml"/> <delete dir="${basedir}/app/config/parameters.yml"/>
<exec executable="cp"> <exec executable="cp">
<arg value="${basedir}/app/config/tests/parameters.yml.dist.sqlite"/> <arg value="${basedir}/app/config/tests/parameters_test.sqlite.yml"/>
<arg value="${basedir}/app/config/parameters.yml"/> <arg value="${basedir}/app/config/parameters_test.yml"/>
</exec> </exec>
<exec executable="php"> <exec executable="php">
@ -70,8 +70,8 @@
<target name="db_pgsql" description="Run test for PostgreSQL"> <target name="db_pgsql" description="Run test for PostgreSQL">
<delete dir="${basedir}/app/config/parameters.yml"/> <delete dir="${basedir}/app/config/parameters.yml"/>
<exec executable="cp"> <exec executable="cp">
<arg value="${basedir}/app/config/tests/parameters.yml.dist.pgsql"/> <arg value="${basedir}/app/config/tests/parameters_test.pgsql.yml"/>
<arg value="${basedir}/app/config/parameters.yml"/> <arg value="${basedir}/app/config/parameters_test.yml"/>
</exec> </exec>
<exec executable="php"> <exec executable="php">

View File

@ -30,7 +30,7 @@ class WallabagAnnotationController extends FOSRestController
->getRepository('WallabagAnnotationBundle:Annotation') ->getRepository('WallabagAnnotationBundle:Annotation')
->findAnnotationsByPageId($entry->getId(), $this->getUser()->getId()); ->findAnnotationsByPageId($entry->getId(), $this->getUser()->getId());
$total = count($annotationRows); $total = count($annotationRows);
$annotations = array('total' => $total, 'rows' => $annotationRows); $annotations = ['total' => $total, 'rows' => $annotationRows];
$json = $this->get('serializer')->serialize($annotations, 'json'); $json = $this->get('serializer')->serialize($annotations, 'json');
@ -141,6 +141,6 @@ class WallabagAnnotationController extends FOSRestController
*/ */
private function renderJsonResponse($json, $code = 200) private function renderJsonResponse($json, $code = 200)
{ {
return new Response($json, $code, array('application/json')); return new Response($json, $code, ['application/json']);
} }
} }

View File

@ -35,13 +35,13 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
->getRepository('WallabagCoreBundle:Entry') ->getRepository('WallabagCoreBundle:Entry')
->findOneByUsernameAndNotArchived('admin'); ->findOneByUsernameAndNotArchived('admin');
$headers = array('CONTENT_TYPE' => 'application/json'); $headers = ['CONTENT_TYPE' => 'application/json'];
$content = json_encode(array( $content = json_encode([
'text' => 'my annotation', 'text' => 'my annotation',
'quote' => 'my quote', 'quote' => 'my quote',
'ranges' => array('start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31), 'ranges' => ['start' => '', 'startOffset' => 24, 'end' => '', 'endOffset' => 31],
)); ]);
$crawler = $this->client->request('POST', 'annotations/'.$entry->getId().'.json', array(), array(), $headers, $content); $crawler = $this->client->request('POST', 'annotations/'.$entry->getId().'.json', [], [], $headers, $content);
$this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@ -69,11 +69,11 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
$this->logInAs('admin'); $this->logInAs('admin');
$headers = array('CONTENT_TYPE' => 'application/json'); $headers = ['CONTENT_TYPE' => 'application/json'];
$content = json_encode(array( $content = json_encode([
'text' => 'a modified annotation', 'text' => 'a modified annotation',
)); ]);
$crawler = $this->client->request('PUT', 'annotations/'.$annotation->getId().'.json', array(), array(), $headers, $content); $crawler = $this->client->request('PUT', 'annotations/'.$annotation->getId().'.json', [], [], $headers, $content);
$this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
$content = json_decode($this->client->getResponse()->getContent(), true); $content = json_decode($this->client->getResponse()->getContent(), true);
@ -99,11 +99,11 @@ class AnnotationControllerTest extends WallabagAnnotationTestCase
$this->logInAs('admin'); $this->logInAs('admin');
$headers = array('CONTENT_TYPE' => 'application/json'); $headers = ['CONTENT_TYPE' => 'application/json'];
$content = json_encode(array( $content = json_encode([
'text' => 'a modified annotation', 'text' => 'a modified annotation',
)); ]);
$crawler = $this->client->request('DELETE', 'annotations/'.$annotation->getId().'.json', array(), array(), $headers, $content); $crawler = $this->client->request('DELETE', 'annotations/'.$annotation->getId().'.json', [], [], $headers, $content);
$this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
$content = json_decode($this->client->getResponse()->getContent(), true); $content = json_decode($this->client->getResponse()->getContent(), true);

View File

@ -26,10 +26,10 @@ abstract class WallabagAnnotationTestCase extends WebTestCase
{ {
$crawler = $this->client->request('GET', '/login'); $crawler = $this->client->request('GET', '/login');
$form = $crawler->filter('button[type=submit]')->form(); $form = $crawler->filter('button[type=submit]')->form();
$data = array( $data = [
'_username' => $username, '_username' => $username,
'_password' => 'mypassword', '_password' => 'mypassword',
); ];
$this->client->submit($form, $data); $this->client->submit($form, $data);
} }
@ -48,7 +48,7 @@ abstract class WallabagAnnotationTestCase extends WebTestCase
$loginManager = $container->get('fos_user.security.login_manager'); $loginManager = $container->get('fos_user.security.login_manager');
$firewallName = $container->getParameter('fos_user.firewall_name'); $firewallName = $container->getParameter('fos_user.firewall_name');
$this->user = $userManager->findUserBy(array('username' => 'admin')); $this->user = $userManager->findUserBy(['username' => 'admin']);
$loginManager->loginUser($firewallName, $this->user); $loginManager->loginUser($firewallName, $this->user);
// save the login token into the session and put it in a cookie // save the login token into the session and put it in a cookie

View File

@ -384,6 +384,6 @@ class WallabagRestController extends FOSRestController
*/ */
private function renderJsonResponse($json) private function renderJsonResponse($json)
{ {
return new Response($json, 200, array('application/json')); return new Response($json, 200, ['application/json']);
} }
} }

View File

@ -13,7 +13,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase
$entry = $this->client->getContainer() $entry = $this->client->getContainer()
->get('doctrine.orm.entity_manager') ->get('doctrine.orm.entity_manager')
->getRepository('WallabagCoreBundle:Entry') ->getRepository('WallabagCoreBundle:Entry')
->findOneBy(array('user' => 1, 'isArchived' => false)); ->findOneBy(['user' => 1, 'isArchived' => false]);
if (!$entry) { if (!$entry) {
$this->markTestSkipped('No content found in db.'); $this->markTestSkipped('No content found in db.');
@ -44,7 +44,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase
$entry = $this->client->getContainer() $entry = $this->client->getContainer()
->get('doctrine.orm.entity_manager') ->get('doctrine.orm.entity_manager')
->getRepository('WallabagCoreBundle:Entry') ->getRepository('WallabagCoreBundle:Entry')
->findOneBy(array('user' => 2, 'isArchived' => false)); ->findOneBy(['user' => 2, 'isArchived' => false]);
if (!$entry) { if (!$entry) {
$this->markTestSkipped('No content found in db.'); $this->markTestSkipped('No content found in db.');
@ -79,7 +79,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase
public function testGetStarredEntries() public function testGetStarredEntries()
{ {
$this->client->request('GET', '/api/entries', array('star' => 1, 'sort' => 'updated')); $this->client->request('GET', '/api/entries', ['star' => 1, 'sort' => 'updated']);
$this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@ -101,7 +101,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase
public function testGetArchiveEntries() public function testGetArchiveEntries()
{ {
$this->client->request('GET', '/api/entries', array('archive' => 1)); $this->client->request('GET', '/api/entries', ['archive' => 1]);
$this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@ -149,10 +149,10 @@ class WallabagRestControllerTest extends WallabagApiTestCase
public function testPostEntry() public function testPostEntry()
{ {
$this->client->request('POST', '/api/entries.json', array( $this->client->request('POST', '/api/entries.json', [
'url' => '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', 'url' => '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',
'tags' => 'google', 'tags' => 'google',
)); ]);
$this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@ -168,11 +168,11 @@ class WallabagRestControllerTest extends WallabagApiTestCase
public function testPostSameEntry() public function testPostSameEntry()
{ {
$this->client->request('POST', '/api/entries.json', array( $this->client->request('POST', '/api/entries.json', [
'url' => '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', 'url' => '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',
'archive' => '1', 'archive' => '1',
'tags' => 'google, apple', 'tags' => 'google, apple',
)); ]);
$this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@ -187,11 +187,11 @@ class WallabagRestControllerTest extends WallabagApiTestCase
public function testPostArchivedAndStarredEntry() public function testPostArchivedAndStarredEntry()
{ {
$this->client->request('POST', '/api/entries.json', array( $this->client->request('POST', '/api/entries.json', [
'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', 'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html',
'archive' => '1', 'archive' => '1',
'starred' => '1', 'starred' => '1',
)); ]);
$this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@ -206,11 +206,11 @@ class WallabagRestControllerTest extends WallabagApiTestCase
public function testPostArchivedAndStarredEntryWithoutQuotes() public function testPostArchivedAndStarredEntryWithoutQuotes()
{ {
$this->client->request('POST', '/api/entries.json', array( $this->client->request('POST', '/api/entries.json', [
'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html', 'url' => 'http://www.lemonde.fr/idees/article/2016/02/08/preserver-la-liberte-d-expression-sur-les-reseaux-sociaux_4861503_3232.html',
'archive' => 0, 'archive' => 0,
'starred' => 1, 'starred' => 1,
)); ]);
$this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@ -236,12 +236,12 @@ class WallabagRestControllerTest extends WallabagApiTestCase
// hydrate the tags relations // hydrate the tags relations
$nbTags = count($entry->getTags()); $nbTags = count($entry->getTags());
$this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', array( $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [
'title' => 'New awesome title', 'title' => 'New awesome title',
'tags' => 'new tag '.uniqid(), 'tags' => 'new tag '.uniqid(),
'starred' => '1', 'starred' => '1',
'archive' => '0', 'archive' => '0',
)); ]);
$this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@ -268,12 +268,12 @@ class WallabagRestControllerTest extends WallabagApiTestCase
// hydrate the tags relations // hydrate the tags relations
$nbTags = count($entry->getTags()); $nbTags = count($entry->getTags());
$this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', array( $this->client->request('PATCH', '/api/entries/'.$entry->getId().'.json', [
'title' => 'New awesome title', 'title' => 'New awesome title',
'tags' => 'new tag '.uniqid(), 'tags' => 'new tag '.uniqid(),
'starred' => 1, 'starred' => 1,
'archive' => 0, 'archive' => 0,
)); ]);
$this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@ -298,9 +298,9 @@ class WallabagRestControllerTest extends WallabagApiTestCase
$this->markTestSkipped('No content found in db.'); $this->markTestSkipped('No content found in db.');
} }
$tags = array(); $tags = [];
foreach ($entry->getTags() as $tag) { foreach ($entry->getTags() as $tag) {
$tags[] = array('id' => $tag->getId(), 'label' => $tag->getLabel(), 'slug' => $tag->getSlug()); $tags[] = ['id' => $tag->getId(), 'label' => $tag->getLabel(), 'slug' => $tag->getSlug()];
} }
$this->client->request('GET', '/api/entries/'.$entry->getId().'/tags'); $this->client->request('GET', '/api/entries/'.$entry->getId().'/tags');
@ -323,7 +323,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase
$newTags = 'tag1,tag2,tag3'; $newTags = 'tag1,tag2,tag3';
$this->client->request('POST', '/api/entries/'.$entry->getId().'/tags', array('tags' => $newTags)); $this->client->request('POST', '/api/entries/'.$entry->getId().'/tags', ['tags' => $newTags]);
$this->assertEquals(200, $this->client->getResponse()->getStatusCode()); $this->assertEquals(200, $this->client->getResponse()->getStatusCode());
@ -337,7 +337,7 @@ class WallabagRestControllerTest extends WallabagApiTestCase
->getRepository('WallabagCoreBundle:Entry') ->getRepository('WallabagCoreBundle:Entry')
->find($entry->getId()); ->find($entry->getId());
$tagsInDB = array(); $tagsInDB = [];
foreach ($entryDB->getTags()->toArray() as $tag) { foreach ($entryDB->getTags()->toArray() as $tag) {
$tagsInDB[$tag->getId()] = $tag->getLabel(); $tagsInDB[$tag->getId()] = $tag->getLabel();
} }

View File

@ -36,7 +36,7 @@ abstract class WallabagApiTestCase extends WebTestCase
$loginManager = $container->get('fos_user.security.login_manager'); $loginManager = $container->get('fos_user.security.login_manager');
$firewallName = $container->getParameter('fos_user.firewall_name'); $firewallName = $container->getParameter('fos_user.firewall_name');
$this->user = $userManager->findUserBy(array('username' => 'admin')); $this->user = $userManager->findUserBy(['username' => 'admin']);
$loginManager->loginUser($firewallName, $this->user); $loginManager->loginUser($firewallName, $this->user);
// save the login token into the session and put it in a cookie // save the login token into the session and put it in a cookie

View File

@ -468,7 +468,7 @@ class InstallCommand extends ContainerAwareCommand
try { try {
return in_array($databaseName, $schemaManager->listDatabases()); return in_array($databaseName, $schemaManager->listDatabases());
} catch (\Doctrine\DBAL\Exception\ConnectionException $e) { } catch (\Doctrine\DBAL\Exception\DriverException $e) {
// it means we weren't able to get database list, assume the database doesn't exist // it means we weren't able to get database list, assume the database doesn't exist
return false; return false;

View File

@ -32,7 +32,7 @@ class ConfigController extends Controller
$user = $this->getUser(); $user = $this->getUser();
// handle basic config detail (this form is defined as a service) // handle basic config detail (this form is defined as a service)
$configForm = $this->createForm(ConfigType::class, $config, array('action' => $this->generateUrl('config'))); $configForm = $this->createForm(ConfigType::class, $config, ['action' => $this->generateUrl('config')]);
$configForm->handleRequest($request); $configForm->handleRequest($request);
if ($configForm->isValid()) { if ($configForm->isValid()) {
@ -52,7 +52,7 @@ class ConfigController extends Controller
} }
// handle changing password // handle changing password
$pwdForm = $this->createForm(ChangePasswordType::class, null, array('action' => $this->generateUrl('config').'#set4')); $pwdForm = $this->createForm(ChangePasswordType::class, null, ['action' => $this->generateUrl('config').'#set4']);
$pwdForm->handleRequest($request); $pwdForm->handleRequest($request);
if ($pwdForm->isValid()) { if ($pwdForm->isValid()) {
@ -71,10 +71,10 @@ class ConfigController extends Controller
} }
// handle changing user information // handle changing user information
$userForm = $this->createForm(UserInformationType::class, $user, array( $userForm = $this->createForm(UserInformationType::class, $user, [
'validation_groups' => array('Profile'), 'validation_groups' => ['Profile'],
'action' => $this->generateUrl('config').'#set3', 'action' => $this->generateUrl('config').'#set3',
)); ]);
$userForm->handleRequest($request); $userForm->handleRequest($request);
if ($userForm->isValid()) { if ($userForm->isValid()) {
@ -89,7 +89,7 @@ class ConfigController extends Controller
} }
// handle rss information // handle rss information
$rssForm = $this->createForm(RssType::class, $config, array('action' => $this->generateUrl('config').'#set2')); $rssForm = $this->createForm(RssType::class, $config, ['action' => $this->generateUrl('config').'#set2']);
$rssForm->handleRequest($request); $rssForm->handleRequest($request);
if ($rssForm->isValid()) { if ($rssForm->isValid()) {
@ -106,7 +106,7 @@ class ConfigController extends Controller
// handle tagging rule // handle tagging rule
$taggingRule = new TaggingRule(); $taggingRule = new TaggingRule();
$newTaggingRule = $this->createForm(TaggingRuleType::class, $taggingRule, array('action' => $this->generateUrl('config').'#set5')); $newTaggingRule = $this->createForm(TaggingRuleType::class, $taggingRule, ['action' => $this->generateUrl('config').'#set5']);
$newTaggingRule->handleRequest($request); $newTaggingRule->handleRequest($request);
if ($newTaggingRule->isValid()) { if ($newTaggingRule->isValid()) {
@ -126,10 +126,10 @@ class ConfigController extends Controller
$newUser = $userManager->createUser(); $newUser = $userManager->createUser();
// enable created user by default // enable created user by default
$newUser->setEnabled(true); $newUser->setEnabled(true);
$newUserForm = $this->createForm(NewUserType::class, $newUser, array( $newUserForm = $this->createForm(NewUserType::class, $newUser, [
'validation_groups' => array('Profile'), 'validation_groups' => ['Profile'],
'action' => $this->generateUrl('config').'#set6', 'action' => $this->generateUrl('config').'#set6',
)); ]);
$newUserForm->handleRequest($request); $newUserForm->handleRequest($request);
if ($newUserForm->isValid() && $this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) { if ($newUserForm->isValid() && $this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) {
@ -147,27 +147,27 @@ class ConfigController extends Controller
$this->get('session')->getFlashBag()->add( $this->get('session')->getFlashBag()->add(
'notice', 'notice',
$this->get('translator')->trans('flashes.config.notice.user_added', array('%username%' => $newUser->getUsername())) $this->get('translator')->trans('flashes.config.notice.user_added', ['%username%' => $newUser->getUsername()])
); );
return $this->redirect($this->generateUrl('config').'#set6'); return $this->redirect($this->generateUrl('config').'#set6');
} }
return $this->render('WallabagCoreBundle:Config:index.html.twig', array( return $this->render('WallabagCoreBundle:Config:index.html.twig', [
'form' => array( 'form' => [
'config' => $configForm->createView(), 'config' => $configForm->createView(),
'rss' => $rssForm->createView(), 'rss' => $rssForm->createView(),
'pwd' => $pwdForm->createView(), 'pwd' => $pwdForm->createView(),
'user' => $userForm->createView(), 'user' => $userForm->createView(),
'new_user' => $newUserForm->createView(), 'new_user' => $newUserForm->createView(),
'new_tagging_rule' => $newTaggingRule->createView(), 'new_tagging_rule' => $newTaggingRule->createView(),
), ],
'rss' => array( 'rss' => [
'username' => $user->getUsername(), 'username' => $user->getUsername(),
'token' => $config->getRssToken(), 'token' => $config->getRssToken(),
), ],
'twofactor_auth' => $this->getParameter('twofactor_auth'), 'twofactor_auth' => $this->getParameter('twofactor_auth'),
)); ]);
} }
/** /**
@ -187,7 +187,7 @@ class ConfigController extends Controller
$em->flush(); $em->flush();
if ($request->isXmlHttpRequest()) { if ($request->isXmlHttpRequest()) {
return new JsonResponse(array('token' => $config->getRssToken())); return new JsonResponse(['token' => $config->getRssToken()]);
} }
$this->get('session')->getFlashBag()->add( $this->get('session')->getFlashBag()->add(
@ -229,7 +229,7 @@ class ConfigController extends Controller
* Retrieve config for the current user. * Retrieve config for the current user.
* If no config were found, create a new one. * If no config were found, create a new one.
* *
* @return Wallabag\CoreBundle\Entity\Config * @return Config
*/ */
private function getConfig() private function getConfig()
{ {

View File

@ -21,9 +21,9 @@ class DeveloperController extends Controller
{ {
$clients = $this->getDoctrine()->getRepository('WallabagApiBundle:Client')->findAll(); $clients = $this->getDoctrine()->getRepository('WallabagApiBundle:Client')->findAll();
return $this->render('WallabagCoreBundle:Developer:index.html.twig', array( return $this->render('WallabagCoreBundle:Developer:index.html.twig', [
'clients' => $clients, 'clients' => $clients,
)); ]);
} }
/** /**
@ -43,7 +43,7 @@ class DeveloperController extends Controller
$clientForm->handleRequest($request); $clientForm->handleRequest($request);
if ($clientForm->isValid()) { if ($clientForm->isValid()) {
$client->setAllowedGrantTypes(array('token', 'authorization_code', 'password', 'refresh_token')); $client->setAllowedGrantTypes(['token', 'authorization_code', 'password', 'refresh_token']);
$em->persist($client); $em->persist($client);
$em->flush(); $em->flush();
@ -52,15 +52,15 @@ class DeveloperController extends Controller
'flashes.developer.notice.client_created' 'flashes.developer.notice.client_created'
); );
return $this->render('WallabagCoreBundle:Developer:client_parameters.html.twig', array( return $this->render('WallabagCoreBundle:Developer:client_parameters.html.twig', [
'client_id' => $client->getPublicId(), 'client_id' => $client->getPublicId(),
'client_secret' => $client->getSecret(), 'client_secret' => $client->getSecret(),
)); ]);
} }
return $this->render('WallabagCoreBundle:Developer:client.html.twig', array( return $this->render('WallabagCoreBundle:Developer:client.html.twig', [
'form' => $clientForm->createView(), 'form' => $clientForm->createView(),
)); ]);
} }
/** /**

View File

@ -54,10 +54,10 @@ class EntryController extends Controller
if (false !== $existingEntry) { if (false !== $existingEntry) {
$this->get('session')->getFlashBag()->add( $this->get('session')->getFlashBag()->add(
'notice', 'notice',
$this->get('translator')->trans('flashes.entry.notice.entry_already_saved', array('%date%' => $existingEntry->getCreatedAt()->format('d-m-Y'))) $this->get('translator')->trans('flashes.entry.notice.entry_already_saved', ['%date%' => $existingEntry->getCreatedAt()->format('d-m-Y')])
); );
return $this->redirect($this->generateUrl('view', array('id' => $existingEntry->getId()))); return $this->redirect($this->generateUrl('view', ['id' => $existingEntry->getId()]));
} }
$this->updateEntry($entry); $this->updateEntry($entry);
@ -69,9 +69,9 @@ class EntryController extends Controller
return $this->redirect($this->generateUrl('homepage')); return $this->redirect($this->generateUrl('homepage'));
} }
return $this->render('WallabagCoreBundle:Entry:new_form.html.twig', array( return $this->render('WallabagCoreBundle:Entry:new_form.html.twig', [
'form' => $form->createView(), 'form' => $form->createView(),
)); ]);
} }
/** /**
@ -131,12 +131,12 @@ class EntryController extends Controller
'flashes.entry.notice.entry_updated' 'flashes.entry.notice.entry_updated'
); );
return $this->redirect($this->generateUrl('view', array('id' => $entry->getId()))); return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()]));
} }
return $this->render('WallabagCoreBundle:Entry:edit.html.twig', array( return $this->render('WallabagCoreBundle:Entry:edit.html.twig', [
'form' => $form->createView(), 'form' => $form->createView(),
)); ]);
} }
/** /**
@ -257,17 +257,17 @@ class EntryController extends Controller
$entries->setCurrentPage($page); $entries->setCurrentPage($page);
} catch (OutOfRangeCurrentPageException $e) { } catch (OutOfRangeCurrentPageException $e) {
if ($page > 1) { if ($page > 1) {
return $this->redirect($this->generateUrl($type, array('page' => $entries->getNbPages())), 302); return $this->redirect($this->generateUrl($type, ['page' => $entries->getNbPages()]), 302);
} }
} }
return $this->render( return $this->render(
'WallabagCoreBundle:Entry:entries.html.twig', 'WallabagCoreBundle:Entry:entries.html.twig',
array( [
'form' => $form->createView(), 'form' => $form->createView(),
'entries' => $entries, 'entries' => $entries,
'currentPage' => $page, 'currentPage' => $page,
) ]
); );
} }
@ -286,7 +286,7 @@ class EntryController extends Controller
return $this->render( return $this->render(
'WallabagCoreBundle:Entry:entry.html.twig', 'WallabagCoreBundle:Entry:entry.html.twig',
array('entry' => $entry) ['entry' => $entry]
); );
} }
@ -314,7 +314,7 @@ class EntryController extends Controller
$message $message
); );
return $this->redirect($this->generateUrl('view', array('id' => $entry->getId()))); return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()]));
} }
/** /**
@ -394,7 +394,7 @@ class EntryController extends Controller
// to avoid redirecting to the deleted entry. Ugh. // to avoid redirecting to the deleted entry. Ugh.
$url = $this->generateUrl( $url = $this->generateUrl(
'view', 'view',
array('id' => $entry->getId()), ['id' => $entry->getId()],
UrlGeneratorInterface::ABSOLUTE_URL UrlGeneratorInterface::ABSOLUTE_URL
); );
@ -426,11 +426,11 @@ class EntryController extends Controller
/** /**
* Check for existing entry, if it exists, redirect to it with a message. * Check for existing entry, if it exists, redirect to it with a message.
* *
* @param $entry * @param Entry $entry
* *
* @return array|bool * @return Entry|bool
*/ */
private function checkIfEntryAlreadyExists($entry) private function checkIfEntryAlreadyExists(Entry $entry)
{ {
return $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId()); return $this->get('wallabag_core.entry_repository')->findByUrlAndUserId($entry->getUrl(), $this->getUser()->getId());
} }

View File

@ -16,12 +16,15 @@ class ExportController extends Controller
/** /**
* Gets one entry content. * Gets one entry content.
* *
* @param Entry $entry * @param Entry $entry
* @param string $format
* *
* @Route("/export/{id}.{format}", name="export_entry", requirements={ * @Route("/export/{id}.{format}", name="export_entry", requirements={
* "format": "epub|mobi|pdf|json|xml|txt|csv", * "format": "epub|mobi|pdf|json|xml|txt|csv",
* "id": "\d+" * "id": "\d+"
* }) * })
*
* @return \Symfony\Component\HttpFoundation\Response
*/ */
public function downloadEntryAction(Entry $entry, $format) public function downloadEntryAction(Entry $entry, $format)
{ {
@ -38,10 +41,15 @@ class ExportController extends Controller
/** /**
* Export all entries for current user. * Export all entries for current user.
* *
* @param string $format
* @param string $category
*
* @Route("/export/{category}.{format}", name="export_entries", requirements={ * @Route("/export/{category}.{format}", name="export_entries", requirements={
* "format": "epub|mobi|pdf|json|xml|txt|csv", * "format": "epub|mobi|pdf|json|xml|txt|csv",
* "category": "all|unread|starred|archive" * "category": "all|unread|starred|archive"
* }) * })
*
* @return \Symfony\Component\HttpFoundation\Response
*/ */
public function downloadEntriesAction($format, $category) public function downloadEntriesAction($format, $category)
{ {

View File

@ -87,9 +87,9 @@ class RssController extends Controller
$perPage = $user->getConfig()->getRssLimit() ?: $this->getParameter('wallabag_core.rss_limit'); $perPage = $user->getConfig()->getRssLimit() ?: $this->getParameter('wallabag_core.rss_limit');
$entries->setMaxPerPage($perPage); $entries->setMaxPerPage($perPage);
return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', array( return $this->render('WallabagCoreBundle:Entry:entries.xml.twig', [
'type' => $type, 'type' => $type,
'entries' => $entries, 'entries' => $entries,
)); ]);
} }
} }

View File

@ -14,7 +14,7 @@ class StaticController extends Controller
{ {
return $this->render( return $this->render(
'WallabagCoreBundle:Static:howto.html.twig', 'WallabagCoreBundle:Static:howto.html.twig',
array() []
); );
} }
@ -25,10 +25,10 @@ class StaticController extends Controller
{ {
return $this->render( return $this->render(
'WallabagCoreBundle:Static:about.html.twig', 'WallabagCoreBundle:Static:about.html.twig',
array( [
'version' => $this->getParameter('wallabag_core.version'), 'version' => $this->getParameter('wallabag_core.version'),
'paypal_url' => $this->getParameter('wallabag_core.paypal_url'), 'paypal_url' => $this->getParameter('wallabag_core.paypal_url'),
) ]
); );
} }
@ -39,7 +39,7 @@ class StaticController extends Controller
{ {
return $this->render( return $this->render(
'WallabagCoreBundle:Static:quickstart.html.twig', 'WallabagCoreBundle:Static:quickstart.html.twig',
array() []
); );
} }
} }

View File

@ -13,6 +13,7 @@ class TagController extends Controller
{ {
/** /**
* @param Request $request * @param Request $request
* @param Entry $entry
* *
* @Route("/new-tag/{entry}", requirements={"entry" = "\d+"}, name="new_tag") * @Route("/new-tag/{entry}", requirements={"entry" = "\d+"}, name="new_tag")
* *
@ -38,13 +39,13 @@ class TagController extends Controller
'flashes.tag.notice.tag_added' 'flashes.tag.notice.tag_added'
); );
return $this->redirect($this->generateUrl('view', array('id' => $entry->getId()))); return $this->redirect($this->generateUrl('view', ['id' => $entry->getId()]));
} }
return $this->render('WallabagCoreBundle:Tag:new_form.html.twig', array( return $this->render('WallabagCoreBundle:Tag:new_form.html.twig', [
'form' => $form->createView(), 'form' => $form->createView(),
'entry' => $entry, 'entry' => $entry,
)); ]);
} }
/** /**
@ -82,9 +83,9 @@ class TagController extends Controller
return $this->render( return $this->render(
'WallabagCoreBundle:Tag:tags.html.twig', 'WallabagCoreBundle:Tag:tags.html.twig',
array( [
'tags' => $tags, 'tags' => $tags,
) ]
); );
} }
} }

View File

@ -16,14 +16,14 @@ class LoadTaggingRuleData extends AbstractFixture implements OrderedFixtureInter
{ {
$tr1 = new TaggingRule(); $tr1 = new TaggingRule();
$tr1->setRule('content matches "spurs"'); $tr1->setRule('content matches "spurs"');
$tr1->setTags(array('sport')); $tr1->setTags(['sport']);
$tr1->setConfig($this->getReference('admin-config')); $tr1->setConfig($this->getReference('admin-config'));
$manager->persist($tr1); $manager->persist($tr1);
$tr2 = new TaggingRule(); $tr2 = new TaggingRule();
$tr2->setRule('content matches "basket"'); $tr2->setRule('content matches "basket"');
$tr2->setTags(array('sport')); $tr2->setTags(['sport']);
$tr2->setConfig($this->getReference('admin-config')); $tr2->setConfig($this->getReference('admin-config'));
$manager->persist($tr2); $manager->persist($tr2);

View File

@ -36,9 +36,9 @@ class LocaleListener implements EventSubscriberInterface
public static function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return array( return [
// must be registered before the default Locale listener // must be registered before the default Locale listener
KernelEvents::REQUEST => array(array('onKernelRequest', 17)), KernelEvents::REQUEST => [['onKernelRequest', 17]],
); ];
} }
} }

View File

@ -28,9 +28,9 @@ class RegistrationConfirmedListener implements EventSubscriberInterface
public static function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return array( return [
FOSUserEvents::REGISTRATION_CONFIRMED => 'authenticate', FOSUserEvents::REGISTRATION_CONFIRMED => 'authenticate',
); ];
} }
public function authenticate(FilterUserResponseEvent $event, $eventName = null, EventDispatcherInterface $eventDispatcher = null) public function authenticate(FilterUserResponseEvent $event, $eventName = null, EventDispatcherInterface $eventDispatcher = null)

View File

@ -15,28 +15,28 @@ class ChangePasswordType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('old_password', PasswordType::class, array( ->add('old_password', PasswordType::class, [
'constraints' => new UserPassword(array('message' => 'validator.password_wrong_value')), 'constraints' => new UserPassword(['message' => 'validator.password_wrong_value']),
'label' => 'config.form_password.old_password_label', 'label' => 'config.form_password.old_password_label',
)) ])
->add('new_password', RepeatedType::class, array( ->add('new_password', RepeatedType::class, [
'type' => PasswordType::class, 'type' => PasswordType::class,
'invalid_message' => 'validator.password_must_match', 'invalid_message' => 'validator.password_must_match',
'required' => true, 'required' => true,
'first_options' => array('label' => 'config.form_password.new_password_label'), 'first_options' => ['label' => 'config.form_password.new_password_label'],
'second_options' => array('label' => 'config.form_password.repeat_new_password_label'), 'second_options' => ['label' => 'config.form_password.repeat_new_password_label'],
'constraints' => array( 'constraints' => [
new Constraints\Length(array( new Constraints\Length([
'min' => 8, 'min' => 8,
'minMessage' => 'validator.password_too_short', 'minMessage' => 'validator.password_too_short',
)), ]),
new Constraints\NotBlank(), new Constraints\NotBlank(),
), ],
'label' => 'config.form_password.new_password_label', 'label' => 'config.form_password.new_password_label',
)) ])
->add('save', SubmitType::class, array( ->add('save', SubmitType::class, [
'label' => 'config.form.save', 'label' => 'config.form.save',
)) ])
; ;
} }

View File

@ -14,8 +14,8 @@ class ClientType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('redirect_uris', UrlType::class, array('required' => true, 'label' => 'developer.client.form.redirect_uris_label')) ->add('redirect_uris', UrlType::class, ['required' => true, 'label' => 'developer.client.form.redirect_uris_label'])
->add('save', SubmitType::class, array('label' => 'developer.client.form.save_label')) ->add('save', SubmitType::class, ['label' => 'developer.client.form.save_label'])
; ;
$builder->get('redirect_uris') $builder->get('redirect_uris')
@ -24,7 +24,7 @@ class ClientType extends AbstractType
return $originalUri; return $originalUri;
}, },
function ($submittedUri) { function ($submittedUri) {
return array($submittedUri); return [$submittedUri];
} }
)) ))
; ;
@ -32,9 +32,9 @@ class ClientType extends AbstractType
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => 'Wallabag\ApiBundle\Entity\Client', 'data_class' => 'Wallabag\ApiBundle\Entity\Client',
)); ]);
} }
public function getBlockPrefix() public function getBlockPrefix()

View File

@ -10,8 +10,8 @@ use Symfony\Component\OptionsResolver\OptionsResolver;
class ConfigType extends AbstractType class ConfigType extends AbstractType
{ {
private $themes = array(); private $themes = [];
private $languages = array(); private $languages = [];
/** /**
* @param array $themes Themes come from the LiipThemeBundle (liip_theme.themes) * @param array $themes Themes come from the LiipThemeBundle (liip_theme.themes)
@ -30,39 +30,39 @@ class ConfigType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('theme', ChoiceType::class, array( ->add('theme', ChoiceType::class, [
'choices' => array_flip($this->themes), 'choices' => array_flip($this->themes),
'choices_as_values' => true, 'choices_as_values' => true,
'label' => 'config.form_settings.theme_label', 'label' => 'config.form_settings.theme_label',
)) ])
->add('items_per_page', null, array( ->add('items_per_page', null, [
'label' => 'config.form_settings.items_per_page_label', 'label' => 'config.form_settings.items_per_page_label',
)) ])
->add('reading_speed', ChoiceType::class, array( ->add('reading_speed', ChoiceType::class, [
'label' => 'config.form_settings.reading_speed.label', 'label' => 'config.form_settings.reading_speed.label',
'choices' => array( 'choices' => [
'config.form_settings.reading_speed.100_word' => '0.5', 'config.form_settings.reading_speed.100_word' => '0.5',
'config.form_settings.reading_speed.200_word' => '1', 'config.form_settings.reading_speed.200_word' => '1',
'config.form_settings.reading_speed.300_word' => '1.5', 'config.form_settings.reading_speed.300_word' => '1.5',
'config.form_settings.reading_speed.400_word' => '2', 'config.form_settings.reading_speed.400_word' => '2',
), ],
)) ])
->add('language', ChoiceType::class, array( ->add('language', ChoiceType::class, [
'choices' => array_flip($this->languages), 'choices' => array_flip($this->languages),
'choices_as_values' => true, 'choices_as_values' => true,
'label' => 'config.form_settings.language_label', 'label' => 'config.form_settings.language_label',
)) ])
->add('save', SubmitType::class, array( ->add('save', SubmitType::class, [
'label' => 'config.form.save', 'label' => 'config.form.save',
)) ])
; ;
} }
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => 'Wallabag\CoreBundle\Entity\Config', 'data_class' => 'Wallabag\CoreBundle\Entity\Config',
)); ]);
} }
public function getBlockPrefix() public function getBlockPrefix()

View File

@ -14,30 +14,30 @@ class EditEntryType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('title', TextType::class, array( ->add('title', TextType::class, [
'required' => true, 'required' => true,
'label' => 'entry.edit.title_label', 'label' => 'entry.edit.title_label',
)) ])
->add('is_public', CheckboxType::class, array( ->add('is_public', CheckboxType::class, [
'required' => false, 'required' => false,
'label' => 'entry.edit.is_public_label', 'label' => 'entry.edit.is_public_label',
)) ])
->add('url', TextType::class, array( ->add('url', TextType::class, [
'disabled' => true, 'disabled' => true,
'required' => false, 'required' => false,
'label' => 'entry.edit.url_label', 'label' => 'entry.edit.url_label',
)) ])
->add('save', SubmitType::class, array( ->add('save', SubmitType::class, [
'label' => 'entry.edit.save_label', 'label' => 'entry.edit.save_label',
)) ])
; ;
} }
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => 'Wallabag\CoreBundle\Entity\Entry', 'data_class' => 'Wallabag\CoreBundle\Entity\Entry',
)); ]);
} }
public function getBlockPrefix() public function getBlockPrefix()

View File

@ -34,28 +34,28 @@ class EntryFilterType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('readingTime', NumberRangeFilterType::class, array( ->add('readingTime', NumberRangeFilterType::class, [
'label' => 'entry.filters.reading_time.label', 'label' => 'entry.filters.reading_time.label',
)) ])
->add('createdAt', DateRangeFilterType::class, array( ->add('createdAt', DateRangeFilterType::class, [
'left_date_options' => array( 'left_date_options' => [
'attr' => array( 'attr' => [
'placeholder' => 'dd/mm/yyyy', 'placeholder' => 'dd/mm/yyyy',
), ],
'format' => 'dd/MM/yyyy', 'format' => 'dd/MM/yyyy',
'widget' => 'single_text', 'widget' => 'single_text',
), ],
'right_date_options' => array( 'right_date_options' => [
'attr' => array( 'attr' => [
'placeholder' => 'dd/mm/yyyy', 'placeholder' => 'dd/mm/yyyy',
), ],
'format' => 'dd/MM/yyyy', 'format' => 'dd/MM/yyyy',
'widget' => 'single_text', 'widget' => 'single_text',
), ],
'label' => 'entry.filters.created_at.label', 'label' => 'entry.filters.created_at.label',
) ]
) )
->add('domainName', TextFilterType::class, array( ->add('domainName', TextFilterType::class, [
'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) {
$value = $values['value']; $value = $values['value'];
if (strlen($value) <= 2 || empty($value)) { if (strlen($value) <= 2 || empty($value)) {
@ -66,14 +66,14 @@ class EntryFilterType extends AbstractType
return $filterQuery->createCondition($expression); return $filterQuery->createCondition($expression);
}, },
'label' => 'entry.filters.domain_label', 'label' => 'entry.filters.domain_label',
)) ])
->add('isArchived', CheckboxFilterType::class, array( ->add('isArchived', CheckboxFilterType::class, [
'label' => 'entry.filters.archived_label', 'label' => 'entry.filters.archived_label',
)) ])
->add('isStarred', CheckboxFilterType::class, array( ->add('isStarred', CheckboxFilterType::class, [
'label' => 'entry.filters.starred_label', 'label' => 'entry.filters.starred_label',
)) ])
->add('previewPicture', CheckboxFilterType::class, array( ->add('previewPicture', CheckboxFilterType::class, [
'apply_filter' => function (QueryInterface $filterQuery, $field, $values) { 'apply_filter' => function (QueryInterface $filterQuery, $field, $values) {
if (false === $values['value']) { if (false === $values['value']) {
return; return;
@ -84,12 +84,12 @@ class EntryFilterType extends AbstractType
return $filterQuery->createCondition($expression); return $filterQuery->createCondition($expression);
}, },
'label' => 'entry.filters.preview_picture_label', 'label' => 'entry.filters.preview_picture_label',
)) ])
->add('language', ChoiceFilterType::class, array( ->add('language', ChoiceFilterType::class, [
'choices' => array_flip($this->repository->findDistinctLanguageByUser($this->user->getId())), 'choices' => array_flip($this->repository->findDistinctLanguageByUser($this->user->getId())),
'choices_as_values' => true, 'choices_as_values' => true,
'label' => 'entry.filters.language_label', 'label' => 'entry.filters.language_label',
)) ])
; ;
} }
@ -100,9 +100,9 @@ class EntryFilterType extends AbstractType
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'csrf_protection' => false, 'csrf_protection' => false,
'validation_groups' => array('filtering'), 'validation_groups' => ['filtering'],
)); ]);
} }
} }

View File

@ -12,18 +12,18 @@ class NewEntryType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('url', UrlType::class, array( ->add('url', UrlType::class, [
'required' => true, 'required' => true,
'label' => 'entry.new.form_new.url_label', 'label' => 'entry.new.form_new.url_label',
)) ])
; ;
} }
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => 'Wallabag\CoreBundle\Entity\Entry', 'data_class' => 'Wallabag\CoreBundle\Entity\Entry',
)); ]);
} }
public function getBlockPrefix() public function getBlockPrefix()

View File

@ -12,15 +12,15 @@ class NewTagType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('label', TextType::class, array('required' => true)) ->add('label', TextType::class, ['required' => true])
; ;
} }
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => 'Wallabag\CoreBundle\Entity\Tag', 'data_class' => 'Wallabag\CoreBundle\Entity\Tag',
)); ]);
} }
public function getBlockPrefix() public function getBlockPrefix()

View File

@ -17,38 +17,38 @@ class NewUserType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('username', TextType::class, array( ->add('username', TextType::class, [
'required' => true, 'required' => true,
'label' => 'config.form_new_user.username_label', 'label' => 'config.form_new_user.username_label',
)) ])
->add('plainPassword', RepeatedType::class, array( ->add('plainPassword', RepeatedType::class, [
'type' => PasswordType::class, 'type' => PasswordType::class,
'invalid_message' => 'validator.password_must_match', 'invalid_message' => 'validator.password_must_match',
'first_options' => array('label' => 'config.form_new_user.password_label'), 'first_options' => ['label' => 'config.form_new_user.password_label'],
'second_options' => array('label' => 'config.form_new_user.repeat_new_password_label'), 'second_options' => ['label' => 'config.form_new_user.repeat_new_password_label'],
'constraints' => array( 'constraints' => [
new Constraints\Length(array( new Constraints\Length([
'min' => 8, 'min' => 8,
'minMessage' => 'validator.password_too_short', 'minMessage' => 'validator.password_too_short',
)), ]),
new Constraints\NotBlank(), new Constraints\NotBlank(),
), ],
'label' => 'config.form_new_user.plain_password_label', 'label' => 'config.form_new_user.plain_password_label',
)) ])
->add('email', EmailType::class, array( ->add('email', EmailType::class, [
'label' => 'config.form_new_user.email_label', 'label' => 'config.form_new_user.email_label',
)) ])
->add('save', SubmitType::class, array( ->add('save', SubmitType::class, [
'label' => 'config.form.save', 'label' => 'config.form.save',
)) ])
; ;
} }
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => 'Wallabag\UserBundle\Entity\User', 'data_class' => 'Wallabag\UserBundle\Entity\User',
)); ]);
} }
public function getBlockPrefix() public function getBlockPrefix()

View File

@ -12,20 +12,20 @@ class RssType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('rss_limit', null, array( ->add('rss_limit', null, [
'label' => 'config.form_rss.rss_limit', 'label' => 'config.form_rss.rss_limit',
)) ])
->add('save', SubmitType::class, array( ->add('save', SubmitType::class, [
'label' => 'config.form.save', 'label' => 'config.form.save',
)) ])
; ;
} }
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => 'Wallabag\CoreBundle\Entity\Config', 'data_class' => 'Wallabag\CoreBundle\Entity\Config',
)); ]);
} }
public function getBlockPrefix() public function getBlockPrefix()

View File

@ -14,19 +14,19 @@ class TaggingRuleType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('rule', TextType::class, array( ->add('rule', TextType::class, [
'required' => true, 'required' => true,
'label' => 'config.form_rules.rule_label', 'label' => 'config.form_rules.rule_label',
)) ])
->add('save', SubmitType::class, array( ->add('save', SubmitType::class, [
'label' => 'config.form.save', 'label' => 'config.form.save',
)) ])
; ;
$tagsField = $builder $tagsField = $builder
->create('tags', TextType::class, array( ->create('tags', TextType::class, [
'label' => 'config.form_rules.tags_label', 'label' => 'config.form_rules.tags_label',
)) ])
->addModelTransformer(new StringToListTransformer(',')); ->addModelTransformer(new StringToListTransformer(','));
$builder->add($tagsField); $builder->add($tagsField);
@ -34,9 +34,9 @@ class TaggingRuleType extends AbstractType
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => 'Wallabag\CoreBundle\Entity\TaggingRule', 'data_class' => 'Wallabag\CoreBundle\Entity\TaggingRule',
)); ]);
} }
public function getBlockPrefix() public function getBlockPrefix()

View File

@ -15,19 +15,19 @@ class UserInformationType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('name', TextType::class, array( ->add('name', TextType::class, [
'label' => 'config.form_user.name_label', 'label' => 'config.form_user.name_label',
)) ])
->add('email', EmailType::class, array( ->add('email', EmailType::class, [
'label' => 'config.form_user.email_label', 'label' => 'config.form_user.email_label',
)) ])
->add('twoFactorAuthentication', CheckboxType::class, array( ->add('twoFactorAuthentication', CheckboxType::class, [
'required' => false, 'required' => false,
'label' => 'config.form_user.twoFactorAuthentication_label', 'label' => 'config.form_user.twoFactorAuthentication_label',
)) ])
->add('save', SubmitType::class, array( ->add('save', SubmitType::class, [
'label' => 'config.form.save', 'label' => 'config.form.save',
)) ])
->remove('username') ->remove('username')
->remove('plainPassword') ->remove('plainPassword')
; ;
@ -40,9 +40,9 @@ class UserInformationType extends AbstractType
public function configureOptions(OptionsResolver $resolver) public function configureOptions(OptionsResolver $resolver)
{ {
$resolver->setDefaults(array( $resolver->setDefaults([
'data_class' => 'Wallabag\UserBundle\Entity\User', 'data_class' => 'Wallabag\UserBundle\Entity\User',
)); ]);
} }
public function getBlockPrefix() public function getBlockPrefix()

View File

@ -82,10 +82,10 @@ class ContentProxy
try { try {
$this->tagger->tag($entry); $this->tagger->tag($entry);
} catch (\Exception $e) { } catch (\Exception $e) {
$this->logger->error('Error while trying to automatically tag an entry.', array( $this->logger->error('Error while trying to automatically tag an entry.', [
'entry_url' => $url, 'entry_url' => $url,
'error_msg' => $e->getMessage(), 'error_msg' => $e->getMessage(),
)); ]);
} }
return $entry; return $entry;

View File

@ -18,10 +18,10 @@ class EntriesExport
private $wallabagUrl; private $wallabagUrl;
private $logoPath; private $logoPath;
private $title = ''; private $title = '';
private $entries = array(); private $entries = [];
private $authors = array('wallabag'); private $authors = ['wallabag'];
private $language = ''; private $language = '';
private $tags = array(); private $tags = [];
private $footerTemplate = '<div style="text-align:center;"> private $footerTemplate = '<div style="text-align:center;">
<p>Produced by wallabag with %EXPORT_METHOD%</p> <p>Produced by wallabag with %EXPORT_METHOD%</p>
<p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p> <p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p>
@ -41,12 +41,14 @@ class EntriesExport
* Define entries. * Define entries.
* *
* @param array|Entry $entries An array of entries or one entry * @param array|Entry $entries An array of entries or one entry
*
* @return EntriesExport
*/ */
public function setEntries($entries) public function setEntries($entries)
{ {
if (!is_array($entries)) { if (!is_array($entries)) {
$this->language = $entries->getLanguage(); $this->language = $entries->getLanguage();
$entries = array($entries); $entries = [$entries];
} }
$this->entries = $entries; $this->entries = $entries;
@ -62,6 +64,8 @@ class EntriesExport
* Sets the category of which we want to get articles, or just one entry. * Sets the category of which we want to get articles, or just one entry.
* *
* @param string $method Method to get articles * @param string $method Method to get articles
*
* @return EntriesExport
*/ */
public function updateTitle($method) public function updateTitle($method)
{ {
@ -78,6 +82,8 @@ class EntriesExport
* Sets the output format. * Sets the output format.
* *
* @param string $format * @param string $format
*
* @return Response
*/ */
public function exportAs($format) public function exportAs($format)
{ {
@ -91,6 +97,8 @@ class EntriesExport
/** /**
* Use PHPePub to dump a .epub file. * Use PHPePub to dump a .epub file.
*
* @return Response
*/ */
private function produceEpub() private function produceEpub()
{ {
@ -162,17 +170,19 @@ class EntriesExport
return Response::create( return Response::create(
$book->getBook(), $book->getBook(),
200, 200,
array( [
'Content-Description' => 'File Transfer', 'Content-Description' => 'File Transfer',
'Content-type' => 'application/epub+zip', 'Content-type' => 'application/epub+zip',
'Content-Disposition' => 'attachment; filename="'.$this->title.'.epub"', 'Content-Disposition' => 'attachment; filename="'.$this->title.'.epub"',
'Content-Transfer-Encoding' => 'binary', 'Content-Transfer-Encoding' => 'binary',
) ]
); );
} }
/** /**
* Use PHPMobi to dump a .mobi file. * Use PHPMobi to dump a .mobi file.
*
* @return Response
*/ */
private function produceMobi() private function produceMobi()
{ {
@ -211,18 +221,20 @@ class EntriesExport
return Response::create( return Response::create(
$mobi->toString(), $mobi->toString(),
200, 200,
array( [
'Accept-Ranges' => 'bytes', 'Accept-Ranges' => 'bytes',
'Content-Description' => 'File Transfer', 'Content-Description' => 'File Transfer',
'Content-type' => 'application/x-mobipocket-ebook', 'Content-type' => 'application/x-mobipocket-ebook',
'Content-Disposition' => 'attachment; filename="'.$this->title.'.mobi"', 'Content-Disposition' => 'attachment; filename="'.$this->title.'.mobi"',
'Content-Transfer-Encoding' => 'binary', 'Content-Transfer-Encoding' => 'binary',
) ]
); );
} }
/** /**
* Use TCPDF to dump a .pdf file. * Use TCPDF to dump a .pdf file.
*
* @return Response
*/ */
private function producePdf() private function producePdf()
{ {
@ -266,17 +278,19 @@ class EntriesExport
return Response::create( return Response::create(
$pdf->Output('', 'S'), $pdf->Output('', 'S'),
200, 200,
array( [
'Content-Description' => 'File Transfer', 'Content-Description' => 'File Transfer',
'Content-type' => 'application/pdf', 'Content-type' => 'application/pdf',
'Content-Disposition' => 'attachment; filename="'.$this->title.'.pdf"', 'Content-Disposition' => 'attachment; filename="'.$this->title.'.pdf"',
'Content-Transfer-Encoding' => 'binary', 'Content-Transfer-Encoding' => 'binary',
) ]
); );
} }
/** /**
* Inspired from CsvFileDumper. * Inspired from CsvFileDumper.
*
* @return Response
*/ */
private function produceCsv() private function produceCsv()
{ {
@ -284,20 +298,20 @@ class EntriesExport
$enclosure = '"'; $enclosure = '"';
$handle = fopen('php://memory', 'rb+'); $handle = fopen('php://memory', 'rb+');
fputcsv($handle, array('Title', 'URL', 'Content', 'Tags', 'MIME Type', 'Language'), $delimiter, $enclosure); fputcsv($handle, ['Title', 'URL', 'Content', 'Tags', 'MIME Type', 'Language'], $delimiter, $enclosure);
foreach ($this->entries as $entry) { foreach ($this->entries as $entry) {
fputcsv( fputcsv(
$handle, $handle,
array( [
$entry->getTitle(), $entry->getTitle(),
$entry->getURL(), $entry->getURL(),
// remove new line to avoid crazy results // remove new line to avoid crazy results
str_replace(array("\r\n", "\r", "\n"), '', $entry->getContent()), str_replace(["\r\n", "\r", "\n"], '', $entry->getContent()),
implode(', ', $entry->getTags()->toArray()), implode(', ', $entry->getTags()->toArray()),
$entry->getMimetype(), $entry->getMimetype(),
$entry->getLanguage(), $entry->getLanguage(),
), ],
$delimiter, $delimiter,
$enclosure $enclosure
); );
@ -310,40 +324,55 @@ class EntriesExport
return Response::create( return Response::create(
$output, $output,
200, 200,
array( [
'Content-type' => 'application/csv', 'Content-type' => 'application/csv',
'Content-Disposition' => 'attachment; filename="'.$this->title.'.csv"', 'Content-Disposition' => 'attachment; filename="'.$this->title.'.csv"',
'Content-Transfer-Encoding' => 'UTF-8', 'Content-Transfer-Encoding' => 'UTF-8',
) ]
); );
} }
/**
* Dump a JSON file.
*
* @return Response
*/
private function produceJson() private function produceJson()
{ {
return Response::create( return Response::create(
$this->prepareSerializingContent('json'), $this->prepareSerializingContent('json'),
200, 200,
array( [
'Content-type' => 'application/json', 'Content-type' => 'application/json',
'Content-Disposition' => 'attachment; filename="'.$this->title.'.json"', 'Content-Disposition' => 'attachment; filename="'.$this->title.'.json"',
'Content-Transfer-Encoding' => 'UTF-8', 'Content-Transfer-Encoding' => 'UTF-8',
) ]
); );
} }
/**
* Dump a XML file.
*
* @return Response
*/
private function produceXml() private function produceXml()
{ {
return Response::create( return Response::create(
$this->prepareSerializingContent('xml'), $this->prepareSerializingContent('xml'),
200, 200,
array( [
'Content-type' => 'application/xml', 'Content-type' => 'application/xml',
'Content-Disposition' => 'attachment; filename="'.$this->title.'.xml"', 'Content-Disposition' => 'attachment; filename="'.$this->title.'.xml"',
'Content-Transfer-Encoding' => 'UTF-8', 'Content-Transfer-Encoding' => 'UTF-8',
) ]
); );
} }
/**
* Dump a TXT file.
*
* @return Response
*/
private function produceTxt() private function produceTxt()
{ {
$content = ''; $content = '';
@ -356,11 +385,11 @@ class EntriesExport
return Response::create( return Response::create(
$content, $content,
200, 200,
array( [
'Content-type' => 'text/plain', 'Content-type' => 'text/plain',
'Content-Disposition' => 'attachment; filename="'.$this->title.'.txt"', 'Content-Disposition' => 'attachment; filename="'.$this->title.'.txt"',
'Content-Transfer-Encoding' => 'UTF-8', 'Content-Transfer-Encoding' => 'UTF-8',
) ]
); );
} }
@ -378,7 +407,7 @@ class EntriesExport
return $serializer->serialize( return $serializer->serialize(
$this->entries, $this->entries,
$format, $format,
SerializationContext::create()->setGroups(array('entries_for_user')) SerializationContext::create()->setGroups(['entries_for_user'])
); );
} }

View File

@ -54,7 +54,7 @@ class RuleBasedTagger
public function tagAllForUser(User $user) public function tagAllForUser(User $user)
{ {
$rules = $this->getRulesForUser($user); $rules = $this->getRulesForUser($user);
$entries = array(); $entries = [];
foreach ($rules as $rule) { foreach ($rules as $rule) {
$qb = $this->entryRepository->getBuilderForAllByUser($user->getId()); $qb = $this->entryRepository->getBuilderForAllByUser($user->getId());

View File

@ -157,7 +157,7 @@ class EntryRepository extends EntityRepository
->getQuery() ->getQuery()
->getResult(); ->getResult();
$languages = array(); $languages = [];
foreach ($results as $result) { foreach ($results as $result) {
$languages[$result['language']] = $result['language']; $languages[$result['language']] = $result['language'];
} }
@ -233,7 +233,7 @@ class EntryRepository extends EntityRepository
* @param $url * @param $url
* @param $userId * @param $userId
* *
* @return array|bool * @return Entry|bool
*/ */
public function findByUrlAndUserId($url, $userId) public function findByUrlAndUserId($url, $userId)
{ {

View File

@ -27,7 +27,7 @@ class TablePrefixSubscriber implements EventSubscriber
public function getSubscribedEvents() public function getSubscribedEvents()
{ {
return array('loadClassMetadata'); return ['loadClassMetadata'];
} }
public function loadClassMetadata(LoadClassMetadataEventArgs $args) public function loadClassMetadata(LoadClassMetadataEventArgs $args)

View File

@ -37,11 +37,11 @@ class InstallCommandTest extends WallabagCoreTestCase
$application = new Application(static::$kernel); $application = new Application(static::$kernel);
$application->setAutoExit(false); $application->setAutoExit(false);
$code = $application->run(new ArrayInput(array( $code = $application->run(new ArrayInput([
'command' => 'doctrine:fixtures:load', 'command' => 'doctrine:fixtures:load',
'--no-interaction' => true, '--no-interaction' => true,
'--env' => 'test', '--env' => 'test',
)), new NullOutput()); ]), new NullOutput());
} }
public function testRunInstallCommand() public function testRunInstallCommand()
@ -63,9 +63,9 @@ class InstallCommandTest extends WallabagCoreTestCase
$command->getHelperSet()->set($question, 'question'); $command->getHelperSet()->set($question, 'question');
$tester = new CommandTester($command); $tester = new CommandTester($command);
$tester->execute(array( $tester->execute([
'command' => $command->getName(), 'command' => $command->getName(),
)); ]);
$this->assertContains('Checking system requirements.', $tester->getDisplay()); $this->assertContains('Checking system requirements.', $tester->getDisplay());
$this->assertContains('Setting up database.', $tester->getDisplay()); $this->assertContains('Setting up database.', $tester->getDisplay());
@ -93,10 +93,10 @@ class InstallCommandTest extends WallabagCoreTestCase
$command->getHelperSet()->set($question, 'question'); $command->getHelperSet()->set($question, 'question');
$tester = new CommandTester($command); $tester = new CommandTester($command);
$tester->execute(array( $tester->execute([
'command' => $command->getName(), 'command' => $command->getName(),
'--reset' => true, '--reset' => true,
)); ]);
$this->assertContains('Checking system requirements.', $tester->getDisplay()); $this->assertContains('Checking system requirements.', $tester->getDisplay());
$this->assertContains('Setting up database.', $tester->getDisplay()); $this->assertContains('Setting up database.', $tester->getDisplay());
@ -116,10 +116,10 @@ class InstallCommandTest extends WallabagCoreTestCase
// drop database first, so the install command won't ask to reset things // drop database first, so the install command won't ask to reset things
$command = $application->find('doctrine:database:drop'); $command = $application->find('doctrine:database:drop');
$command->run(new ArrayInput(array( $command->run(new ArrayInput([
'command' => 'doctrine:database:drop', 'command' => 'doctrine:database:drop',
'--force' => true, '--force' => true,
)), new NullOutput()); ]), new NullOutput());
// start a new application to avoid lagging connexion to pgsql // start a new application to avoid lagging connexion to pgsql
$client = static::createClient(); $client = static::createClient();
@ -140,9 +140,9 @@ class InstallCommandTest extends WallabagCoreTestCase
$command->getHelperSet()->set($question, 'question'); $command->getHelperSet()->set($question, 'question');
$tester = new CommandTester($command); $tester = new CommandTester($command);
$tester->execute(array( $tester->execute([
'command' => $command->getName(), 'command' => $command->getName(),
)); ]);
$this->assertContains('Checking system requirements.', $tester->getDisplay()); $this->assertContains('Checking system requirements.', $tester->getDisplay());
$this->assertContains('Setting up database.', $tester->getDisplay()); $this->assertContains('Setting up database.', $tester->getDisplay());
@ -178,9 +178,9 @@ class InstallCommandTest extends WallabagCoreTestCase
$command->getHelperSet()->set($question, 'question'); $command->getHelperSet()->set($question, 'question');
$tester = new CommandTester($command); $tester = new CommandTester($command);
$tester->execute(array( $tester->execute([
'command' => $command->getName(), 'command' => $command->getName(),
)); ]);
$this->assertContains('Checking system requirements.', $tester->getDisplay()); $this->assertContains('Checking system requirements.', $tester->getDisplay());
$this->assertContains('Setting up database.', $tester->getDisplay()); $this->assertContains('Setting up database.', $tester->getDisplay());
@ -201,19 +201,19 @@ class InstallCommandTest extends WallabagCoreTestCase
// drop database first, so the install command won't ask to reset things // drop database first, so the install command won't ask to reset things
$command = new DropDatabaseDoctrineCommand(); $command = new DropDatabaseDoctrineCommand();
$command->setApplication($application); $command->setApplication($application);
$command->run(new ArrayInput(array( $command->run(new ArrayInput([
'command' => 'doctrine:database:drop', 'command' => 'doctrine:database:drop',
'--force' => true, '--force' => true,
)), new NullOutput()); ]), new NullOutput());
$this->getClient()->getContainer()->get('doctrine')->getConnection()->close(); $this->getClient()->getContainer()->get('doctrine')->getConnection()->close();
$command = new CreateDatabaseDoctrineCommand(); $command = new CreateDatabaseDoctrineCommand();
$command->setApplication($application); $command->setApplication($application);
$command->run(new ArrayInput(array( $command->run(new ArrayInput([
'command' => 'doctrine:database:create', 'command' => 'doctrine:database:create',
'--env' => 'test', '--env' => 'test',
)), new NullOutput()); ]), new NullOutput());
$command = $application->find('wallabag:install'); $command = $application->find('wallabag:install');
@ -233,9 +233,9 @@ class InstallCommandTest extends WallabagCoreTestCase
$command->getHelperSet()->set($question, 'question'); $command->getHelperSet()->set($question, 'question');
$tester = new CommandTester($command); $tester = new CommandTester($command);
$tester->execute(array( $tester->execute([
'command' => $command->getName(), 'command' => $command->getName(),
)); ]);
$this->assertContains('Checking system requirements.', $tester->getDisplay()); $this->assertContains('Checking system requirements.', $tester->getDisplay());
$this->assertContains('Setting up database.', $tester->getDisplay()); $this->assertContains('Setting up database.', $tester->getDisplay());
@ -265,10 +265,10 @@ class InstallCommandTest extends WallabagCoreTestCase
$command->getHelperSet()->set($question, 'question'); $command->getHelperSet()->set($question, 'question');
$tester = new CommandTester($command); $tester = new CommandTester($command);
$tester->execute(array( $tester->execute([
'command' => $command->getName(), 'command' => $command->getName(),
'--no-interaction' => true, '--no-interaction' => true,
)); ]);
$this->assertContains('Checking system requirements.', $tester->getDisplay()); $this->assertContains('Checking system requirements.', $tester->getDisplay());
$this->assertContains('Setting up database.', $tester->getDisplay()); $this->assertContains('Setting up database.', $tester->getDisplay());

View File

@ -21,9 +21,9 @@ class TagAllCommandTest extends WallabagCoreTestCase
$command = $application->find('wallabag:tag:all'); $command = $application->find('wallabag:tag:all');
$tester = new CommandTester($command); $tester = new CommandTester($command);
$tester->execute(array( $tester->execute([
'command' => $command->getName(), 'command' => $command->getName(),
)); ]);
} }
public function testRunTagAllCommandWithBadUsername() public function testRunTagAllCommandWithBadUsername()
@ -34,10 +34,10 @@ class TagAllCommandTest extends WallabagCoreTestCase
$command = $application->find('wallabag:tag:all'); $command = $application->find('wallabag:tag:all');
$tester = new CommandTester($command); $tester = new CommandTester($command);
$tester->execute(array( $tester->execute([
'command' => $command->getName(), 'command' => $command->getName(),
'username' => 'unknown', 'username' => 'unknown',
)); ]);
$this->assertContains('User "unknown" not found', $tester->getDisplay()); $this->assertContains('User "unknown" not found', $tester->getDisplay());
} }
@ -50,10 +50,10 @@ class TagAllCommandTest extends WallabagCoreTestCase
$command = $application->find('wallabag:tag:all'); $command = $application->find('wallabag:tag:all');
$tester = new CommandTester($command); $tester = new CommandTester($command);
$tester->execute(array( $tester->execute([
'command' => $command->getName(), 'command' => $command->getName(),
'username' => 'admin', 'username' => 'admin',
)); ]);
$this->assertContains('Tagging entries for user « admin »... Done', $tester->getDisplay()); $this->assertContains('Tagging entries for user « admin »... Done', $tester->getDisplay());
} }

View File

@ -43,12 +43,12 @@ class ConfigControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('button[id=config_save]')->form(); $form = $crawler->filter('button[id=config_save]')->form();
$data = array( $data = [
'config[theme]' => 'baggy', 'config[theme]' => 'baggy',
'config[items_per_page]' => '30', 'config[items_per_page]' => '30',
'config[reading_speed]' => '0.5', 'config[reading_speed]' => '0.5',
'config[language]' => 'en', 'config[language]' => 'en',
); ];
$client->submit($form, $data); $client->submit($form, $data);
@ -56,19 +56,19 @@ class ConfigControllerTest extends WallabagCoreTestCase
$crawler = $client->followRedirect(); $crawler = $client->followRedirect();
$this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text']));
$this->assertContains('flashes.config.notice.config_saved', $alert[0]); $this->assertContains('flashes.config.notice.config_saved', $alert[0]);
} }
public function dataForUpdateFailed() public function dataForUpdateFailed()
{ {
return array( return [
array(array( [[
'config[theme]' => 'baggy', 'config[theme]' => 'baggy',
'config[items_per_page]' => '', 'config[items_per_page]' => '',
'config[language]' => 'en', 'config[language]' => 'en',
)), ]],
); ];
} }
/** /**
@ -89,46 +89,46 @@ class ConfigControllerTest extends WallabagCoreTestCase
$this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertEquals(200, $client->getResponse()->getStatusCode());
$this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text']));
$this->assertContains('This value should not be blank', $alert[0]); $this->assertContains('This value should not be blank', $alert[0]);
} }
public function dataForChangePasswordFailed() public function dataForChangePasswordFailed()
{ {
return array( return [
array( [
array( [
'change_passwd[old_password]' => 'material', 'change_passwd[old_password]' => 'material',
'change_passwd[new_password][first]' => '', 'change_passwd[new_password][first]' => '',
'change_passwd[new_password][second]' => '', 'change_passwd[new_password][second]' => '',
), ],
'validator.password_wrong_value', 'validator.password_wrong_value',
), ],
array( [
array( [
'change_passwd[old_password]' => 'mypassword', 'change_passwd[old_password]' => 'mypassword',
'change_passwd[new_password][first]' => '', 'change_passwd[new_password][first]' => '',
'change_passwd[new_password][second]' => '', 'change_passwd[new_password][second]' => '',
), ],
'This value should not be blank', 'This value should not be blank',
), ],
array( [
array( [
'change_passwd[old_password]' => 'mypassword', 'change_passwd[old_password]' => 'mypassword',
'change_passwd[new_password][first]' => 'hop', 'change_passwd[new_password][first]' => 'hop',
'change_passwd[new_password][second]' => '', 'change_passwd[new_password][second]' => '',
), ],
'validator.password_must_match', 'validator.password_must_match',
), ],
array( [
array( [
'change_passwd[old_password]' => 'mypassword', 'change_passwd[old_password]' => 'mypassword',
'change_passwd[new_password][first]' => 'hop', 'change_passwd[new_password][first]' => 'hop',
'change_passwd[new_password][second]' => 'hop', 'change_passwd[new_password][second]' => 'hop',
), ],
'validator.password_too_short', 'validator.password_too_short',
), ],
); ];
} }
/** /**
@ -149,7 +149,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
$this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertEquals(200, $client->getResponse()->getStatusCode());
$this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text']));
$this->assertContains($expectedMessage, $alert[0]); $this->assertContains($expectedMessage, $alert[0]);
} }
@ -164,11 +164,11 @@ class ConfigControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('button[id=change_passwd_save]')->form(); $form = $crawler->filter('button[id=change_passwd_save]')->form();
$data = array( $data = [
'change_passwd[old_password]' => 'mypassword', 'change_passwd[old_password]' => 'mypassword',
'change_passwd[new_password][first]' => 'mypassword', 'change_passwd[new_password][first]' => 'mypassword',
'change_passwd[new_password][second]' => 'mypassword', 'change_passwd[new_password][second]' => 'mypassword',
); ];
$client->submit($form, $data); $client->submit($form, $data);
@ -176,28 +176,28 @@ class ConfigControllerTest extends WallabagCoreTestCase
$crawler = $client->followRedirect(); $crawler = $client->followRedirect();
$this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text']));
$this->assertContains('flashes.config.notice.password_updated', $alert[0]); $this->assertContains('flashes.config.notice.password_updated', $alert[0]);
} }
public function dataForUserFailed() public function dataForUserFailed()
{ {
return array( return [
array( [
array( [
'update_user[name]' => '', 'update_user[name]' => '',
'update_user[email]' => '', 'update_user[email]' => '',
), ],
'fos_user.email.blank', 'fos_user.email.blank',
), ],
array( [
array( [
'update_user[name]' => '', 'update_user[name]' => '',
'update_user[email]' => 'test', 'update_user[email]' => 'test',
), ],
'fos_user.email.invalid', 'fos_user.email.invalid',
), ],
); ];
} }
/** /**
@ -218,7 +218,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
$this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertEquals(200, $client->getResponse()->getStatusCode());
$this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text']));
$this->assertContains($expectedMessage, $alert[0]); $this->assertContains($expectedMessage, $alert[0]);
} }
@ -233,10 +233,10 @@ class ConfigControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('button[id=update_user_save]')->form(); $form = $crawler->filter('button[id=update_user_save]')->form();
$data = array( $data = [
'update_user[name]' => 'new name', 'update_user[name]' => 'new name',
'update_user[email]' => 'admin@wallabag.io', 'update_user[email]' => 'admin@wallabag.io',
); ];
$client->submit($form, $data); $client->submit($form, $data);
@ -244,59 +244,59 @@ class ConfigControllerTest extends WallabagCoreTestCase
$crawler = $client->followRedirect(); $crawler = $client->followRedirect();
$this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text']));
$this->assertContains('flashes.config.notice.user_updated', $alert[0]); $this->assertContains('flashes.config.notice.user_updated', $alert[0]);
} }
public function dataForNewUserFailed() public function dataForNewUserFailed()
{ {
return array( return [
array( [
array( [
'new_user[username]' => '', 'new_user[username]' => '',
'new_user[plainPassword][first]' => '', 'new_user[plainPassword][first]' => '',
'new_user[plainPassword][second]' => '', 'new_user[plainPassword][second]' => '',
'new_user[email]' => '', 'new_user[email]' => '',
), ],
'fos_user.username.blank', 'fos_user.username.blank',
), ],
array( [
array( [
'new_user[username]' => 'a', 'new_user[username]' => 'a',
'new_user[plainPassword][first]' => 'mypassword', 'new_user[plainPassword][first]' => 'mypassword',
'new_user[plainPassword][second]' => 'mypassword', 'new_user[plainPassword][second]' => 'mypassword',
'new_user[email]' => '', 'new_user[email]' => '',
), ],
'fos_user.username.short', 'fos_user.username.short',
), ],
array( [
array( [
'new_user[username]' => 'wallace', 'new_user[username]' => 'wallace',
'new_user[plainPassword][first]' => 'mypassword', 'new_user[plainPassword][first]' => 'mypassword',
'new_user[plainPassword][second]' => 'mypassword', 'new_user[plainPassword][second]' => 'mypassword',
'new_user[email]' => 'test', 'new_user[email]' => 'test',
), ],
'fos_user.email.invalid', 'fos_user.email.invalid',
), ],
array( [
array( [
'new_user[username]' => 'admin', 'new_user[username]' => 'admin',
'new_user[plainPassword][first]' => 'wallacewallace', 'new_user[plainPassword][first]' => 'wallacewallace',
'new_user[plainPassword][second]' => 'wallacewallace', 'new_user[plainPassword][second]' => 'wallacewallace',
'new_user[email]' => 'wallace@wallace.me', 'new_user[email]' => 'wallace@wallace.me',
), ],
'fos_user.username.already_used', 'fos_user.username.already_used',
), ],
array( [
array( [
'new_user[username]' => 'wallace', 'new_user[username]' => 'wallace',
'new_user[plainPassword][first]' => 'mypassword1', 'new_user[plainPassword][first]' => 'mypassword1',
'new_user[plainPassword][second]' => 'mypassword2', 'new_user[plainPassword][second]' => 'mypassword2',
'new_user[email]' => 'wallace@wallace.me', 'new_user[email]' => 'wallace@wallace.me',
), ],
'validator.password_must_match', 'validator.password_must_match',
), ],
); ];
} }
/** /**
@ -317,7 +317,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
$this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertEquals(200, $client->getResponse()->getStatusCode());
$this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text']));
$this->assertContains($expectedMessage, $alert[0]); $this->assertContains($expectedMessage, $alert[0]);
} }
@ -332,12 +332,12 @@ class ConfigControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('button[id=new_user_save]')->form(); $form = $crawler->filter('button[id=new_user_save]')->form();
$data = array( $data = [
'new_user[username]' => 'wallace', 'new_user[username]' => 'wallace',
'new_user[plainPassword][first]' => 'wallace1', 'new_user[plainPassword][first]' => 'wallace1',
'new_user[plainPassword][second]' => 'wallace1', 'new_user[plainPassword][second]' => 'wallace1',
'new_user[email]' => 'wallace@wallace.me', 'new_user[email]' => 'wallace@wallace.me',
); ];
$client->submit($form, $data); $client->submit($form, $data);
@ -345,7 +345,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
$crawler = $client->followRedirect(); $crawler = $client->followRedirect();
$this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text']));
$this->assertContains('flashes.config.notice.user_added', $alert[0]); $this->assertContains('flashes.config.notice.user_added', $alert[0]);
$em = $client->getContainer()->get('doctrine.orm.entity_manager'); $em = $client->getContainer()->get('doctrine.orm.entity_manager');
@ -381,7 +381,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
$this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertEquals(200, $client->getResponse()->getStatusCode());
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertContains('config.form_rss.no_token', $body[0]); $this->assertContains('config.form_rss.no_token', $body[0]);
$client->request('GET', '/generate-token'); $client->request('GET', '/generate-token');
@ -389,7 +389,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
$crawler = $client->followRedirect(); $crawler = $client->followRedirect();
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertNotContains('config.form_rss.no_token', $body[0]); $this->assertNotContains('config.form_rss.no_token', $body[0]);
} }
@ -401,9 +401,9 @@ class ConfigControllerTest extends WallabagCoreTestCase
$client->request( $client->request(
'GET', 'GET',
'/generate-token', '/generate-token',
array(), [],
array(), [],
array('HTTP_X-Requested-With' => 'XMLHttpRequest') ['HTTP_X-Requested-With' => 'XMLHttpRequest']
); );
$this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertEquals(200, $client->getResponse()->getStatusCode());
@ -422,9 +422,9 @@ class ConfigControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('button[id=rss_config_save]')->form(); $form = $crawler->filter('button[id=rss_config_save]')->form();
$data = array( $data = [
'rss_config[rss_limit]' => 12, 'rss_config[rss_limit]' => 12,
); ];
$client->submit($form, $data); $client->submit($form, $data);
@ -432,26 +432,26 @@ class ConfigControllerTest extends WallabagCoreTestCase
$crawler = $client->followRedirect(); $crawler = $client->followRedirect();
$this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text']));
$this->assertContains('flashes.config.notice.rss_updated', $alert[0]); $this->assertContains('flashes.config.notice.rss_updated', $alert[0]);
} }
public function dataForRssFailed() public function dataForRssFailed()
{ {
return array( return [
array( [
array( [
'rss_config[rss_limit]' => 0, 'rss_config[rss_limit]' => 0,
), ],
'This value should be 1 or more.', 'This value should be 1 or more.',
), ],
array( [
array( [
'rss_config[rss_limit]' => 1000000000000, 'rss_config[rss_limit]' => 1000000000000,
), ],
'validator.rss_limit_too_hight', 'validator.rss_limit_too_hight',
), ],
); ];
} }
/** /**
@ -472,7 +472,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
$this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertEquals(200, $client->getResponse()->getStatusCode());
$this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $alert = $crawler->filter('body')->extract(['_text']));
$this->assertContains($expectedMessage, $alert[0]); $this->assertContains($expectedMessage, $alert[0]);
} }
@ -487,10 +487,10 @@ class ConfigControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('button[id=tagging_rule_save]')->form(); $form = $crawler->filter('button[id=tagging_rule_save]')->form();
$data = array( $data = [
'tagging_rule[rule]' => 'readingTime <= 3', 'tagging_rule[rule]' => 'readingTime <= 3',
'tagging_rule[tags]' => 'short reading', 'tagging_rule[tags]' => 'short reading',
); ];
$client->submit($form, $data); $client->submit($form, $data);
@ -498,7 +498,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
$crawler = $client->followRedirect(); $crawler = $client->followRedirect();
$this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text']));
$this->assertContains('flashes.config.notice.tagging_rules_updated', $alert[0]); $this->assertContains('flashes.config.notice.tagging_rules_updated', $alert[0]);
$deleteLink = $crawler->filter('.delete')->last()->link(); $deleteLink = $crawler->filter('.delete')->last()->link();
@ -507,34 +507,34 @@ class ConfigControllerTest extends WallabagCoreTestCase
$this->assertEquals(302, $client->getResponse()->getStatusCode()); $this->assertEquals(302, $client->getResponse()->getStatusCode());
$crawler = $client->followRedirect(); $crawler = $client->followRedirect();
$this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(array('_text'))); $this->assertGreaterThan(1, $alert = $crawler->filter('div.messages.success')->extract(['_text']));
$this->assertContains('flashes.config.notice.tagging_rules_deleted', $alert[0]); $this->assertContains('flashes.config.notice.tagging_rules_deleted', $alert[0]);
} }
public function dataForTaggingRuleFailed() public function dataForTaggingRuleFailed()
{ {
return array( return [
array( [
array( [
'tagging_rule[rule]' => 'unknownVar <= 3', 'tagging_rule[rule]' => 'unknownVar <= 3',
'tagging_rule[tags]' => 'cool tag', 'tagging_rule[tags]' => 'cool tag',
), ],
array( [
'The variable', 'The variable',
'does not exist.', 'does not exist.',
), ],
), ],
array( [
array( [
'tagging_rule[rule]' => 'length(domainName) <= 42', 'tagging_rule[rule]' => 'length(domainName) <= 42',
'tagging_rule[tags]' => 'cool tag', 'tagging_rule[tags]' => 'cool tag',
), ],
array( [
'The operator', 'The operator',
'does not exist.', 'does not exist.',
), ],
), ],
); ];
} }
/** /**
@ -555,7 +555,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
$this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertEquals(200, $client->getResponse()->getStatusCode());
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
foreach ($messages as $message) { foreach ($messages as $message) {
$this->assertContains($message, $body[0]); $this->assertContains($message, $body[0]);
@ -574,7 +574,7 @@ class ConfigControllerTest extends WallabagCoreTestCase
$crawler = $client->request('GET', '/tagging-rule/delete/'.$rule->getId()); $crawler = $client->request('GET', '/tagging-rule/delete/'.$rule->getId());
$this->assertEquals(403, $client->getResponse()->getStatusCode()); $this->assertEquals(403, $client->getResponse()->getStatusCode());
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertContains('You can not access this tagging rule', $body[0]); $this->assertContains('You can not access this tagging rule', $body[0]);
} }
@ -593,11 +593,11 @@ class ConfigControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('button[id=change_passwd_save]')->form(); $form = $crawler->filter('button[id=change_passwd_save]')->form();
$data = array( $data = [
'change_passwd[old_password]' => 'mypassword', 'change_passwd[old_password]' => 'mypassword',
'change_passwd[new_password][first]' => 'mypassword', 'change_passwd[new_password][first]' => 'mypassword',
'change_passwd[new_password][second]' => 'mypassword', 'change_passwd[new_password][second]' => 'mypassword',
); ];
$client->submit($form, $data); $client->submit($form, $data);

View File

@ -28,7 +28,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->followRedirect(); $crawler = $client->followRedirect();
$this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertEquals(200, $client->getResponse()->getStatusCode());
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertContains('quickstart.intro.paragraph_1', $body[0]); $this->assertContains('quickstart.intro.paragraph_1', $body[0]);
// Test if quickstart is disabled when user has 1 entry // Test if quickstart is disabled when user has 1 entry
@ -38,16 +38,16 @@ class EntryControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('form[name=entry]')->form(); $form = $crawler->filter('form[name=entry]')->form();
$data = array( $data = [
'entry[url]' => $this->url, 'entry[url]' => $this->url,
); ];
$client->submit($form, $data); $client->submit($form, $data);
$this->assertEquals(302, $client->getResponse()->getStatusCode()); $this->assertEquals(302, $client->getResponse()->getStatusCode());
$client->followRedirect(); $client->followRedirect();
$crawler = $client->request('GET', '/unread/list'); $crawler = $client->request('GET', '/unread/list');
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertContains('entry.list.number_on_the_page', $body[0]); $this->assertContains('entry.list.number_on_the_page', $body[0]);
} }
@ -74,7 +74,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$this->assertCount(4, $crawler->filter('div[class=entry]')); $this->assertCount(4, $crawler->filter('div[class=entry]'));
// Good URL // Good URL
$client->request('GET', '/bookmarklet', array('url' => $this->url)); $client->request('GET', '/bookmarklet', ['url' => $this->url]);
$this->assertEquals(302, $client->getResponse()->getStatusCode()); $this->assertEquals(302, $client->getResponse()->getStatusCode());
$client->followRedirect(); $client->followRedirect();
$crawler = $client->request('GET', '/'); $crawler = $client->request('GET', '/');
@ -103,7 +103,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->submit($form); $crawler = $client->submit($form);
$this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertEquals(200, $client->getResponse()->getStatusCode());
$this->assertCount(1, $alert = $crawler->filter('form ul li')->extract(array('_text'))); $this->assertCount(1, $alert = $crawler->filter('form ul li')->extract(['_text']));
$this->assertEquals('This value should not be blank.', $alert[0]); $this->assertEquals('This value should not be blank.', $alert[0]);
} }
@ -121,9 +121,9 @@ class EntryControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('form[name=entry]')->form(); $form = $crawler->filter('form[name=entry]')->form();
$data = array( $data = [
'entry[url]' => $this->url, 'entry[url]' => $this->url,
); ];
$client->submit($form, $data); $client->submit($form, $data);
@ -150,9 +150,9 @@ class EntryControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('form[name=entry]')->form(); $form = $crawler->filter('form[name=entry]')->form();
$data = array( $data = [
'entry[url]' => $this->url, 'entry[url]' => $this->url,
); ];
$client->submit($form, $data); $client->submit($form, $data);
@ -174,9 +174,9 @@ class EntryControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('form[name=entry]')->form(); $form = $crawler->filter('form[name=entry]')->form();
$data = array( $data = [
'entry[url]' => $url = 'https://github.com/wallabag/wallabag', 'entry[url]' => $url = 'https://github.com/wallabag/wallabag',
); ];
$client->submit($form, $data); $client->submit($form, $data);
@ -245,7 +245,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->request('GET', '/view/'.$content->getId()); $crawler = $client->request('GET', '/view/'.$content->getId());
$this->assertEquals(200, $client->getResponse()->getStatusCode()); $this->assertEquals(200, $client->getResponse()->getStatusCode());
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertContains($content->getTitle(), $body[0]); $this->assertContains($content->getTitle(), $body[0]);
} }
@ -315,9 +315,9 @@ class EntryControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('button[type=submit]')->form(); $form = $crawler->filter('button[type=submit]')->form();
$data = array( $data = [
'entry[title]' => 'My updated title hehe :)', 'entry[title]' => 'My updated title hehe :)',
); ];
$client->submit($form, $data); $client->submit($form, $data);
@ -325,7 +325,7 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->followRedirect(); $crawler = $client->followRedirect();
$this->assertGreaterThan(1, $alert = $crawler->filter('div[id=article] h1')->extract(array('_text'))); $this->assertGreaterThan(1, $alert = $crawler->filter('div[id=article] h1')->extract(['_text']));
$this->assertContains('My updated title hehe :)', $alert[0]); $this->assertContains('My updated title hehe :)', $alert[0]);
} }
@ -461,10 +461,10 @@ class EntryControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('button[id=submit-filter]')->form(); $form = $crawler->filter('button[id=submit-filter]')->form();
$data = array( $data = [
'entry_filter[readingTime][right_number]' => 11, 'entry_filter[readingTime][right_number]' => 11,
'entry_filter[readingTime][left_number]' => 11, 'entry_filter[readingTime][left_number]' => 11,
); ];
$crawler = $client->submit($form, $data); $crawler = $client->submit($form, $data);
@ -480,28 +480,28 @@ class EntryControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('button[id=submit-filter]')->form(); $form = $crawler->filter('button[id=submit-filter]')->form();
$data = array( $data = [
'entry_filter[createdAt][left_date]' => date('d/m/Y'), 'entry_filter[createdAt][left_date]' => date('d/m/Y'),
'entry_filter[createdAt][right_date]' => date('d/m/Y', strtotime('+1 day')), 'entry_filter[createdAt][right_date]' => date('d/m/Y', strtotime('+1 day')),
); ];
$crawler = $client->submit($form, $data); $crawler = $client->submit($form, $data);
$this->assertCount(5, $crawler->filter('div[class=entry]')); $this->assertCount(5, $crawler->filter('div[class=entry]'));
$data = array( $data = [
'entry_filter[createdAt][left_date]' => date('d/m/Y'), 'entry_filter[createdAt][left_date]' => date('d/m/Y'),
'entry_filter[createdAt][right_date]' => date('d/m/Y'), 'entry_filter[createdAt][right_date]' => date('d/m/Y'),
); ];
$crawler = $client->submit($form, $data); $crawler = $client->submit($form, $data);
$this->assertCount(5, $crawler->filter('div[class=entry]')); $this->assertCount(5, $crawler->filter('div[class=entry]'));
$data = array( $data = [
'entry_filter[createdAt][left_date]' => '01/01/1970', 'entry_filter[createdAt][left_date]' => '01/01/1970',
'entry_filter[createdAt][right_date]' => '01/01/1970', 'entry_filter[createdAt][right_date]' => '01/01/1970',
); ];
$crawler = $client->submit($form, $data); $crawler = $client->submit($form, $data);
@ -516,9 +516,9 @@ class EntryControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('button[id=config_save]')->form(); $form = $crawler->filter('button[id=config_save]')->form();
$data = array( $data = [
'config[items_per_page]' => '1', 'config[items_per_page]' => '1',
); ];
$client->submit($form, $data); $client->submit($form, $data);
@ -531,9 +531,9 @@ class EntryControllerTest extends WallabagCoreTestCase
// reset pagination // reset pagination
$crawler = $client->request('GET', '/config'); $crawler = $client->request('GET', '/config');
$form = $crawler->filter('button[id=config_save]')->form(); $form = $crawler->filter('button[id=config_save]')->form();
$data = array( $data = [
'config[items_per_page]' => '12', 'config[items_per_page]' => '12',
); ];
$client->submit($form, $data); $client->submit($form, $data);
} }
@ -544,17 +544,17 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->request('GET', '/unread/list'); $crawler = $client->request('GET', '/unread/list');
$form = $crawler->filter('button[id=submit-filter]')->form(); $form = $crawler->filter('button[id=submit-filter]')->form();
$data = array( $data = [
'entry_filter[domainName]' => 'domain', 'entry_filter[domainName]' => 'domain',
); ];
$crawler = $client->submit($form, $data); $crawler = $client->submit($form, $data);
$this->assertCount(5, $crawler->filter('div[class=entry]')); $this->assertCount(5, $crawler->filter('div[class=entry]'));
$form = $crawler->filter('button[id=submit-filter]')->form(); $form = $crawler->filter('button[id=submit-filter]')->form();
$data = array( $data = [
'entry_filter[domainName]' => 'wallabag', 'entry_filter[domainName]' => 'wallabag',
); ];
$crawler = $client->submit($form, $data); $crawler = $client->submit($form, $data);
$this->assertCount(0, $crawler->filter('div[class=entry]')); $this->assertCount(0, $crawler->filter('div[class=entry]'));
@ -601,17 +601,17 @@ class EntryControllerTest extends WallabagCoreTestCase
$crawler = $client->request('GET', '/unread/list'); $crawler = $client->request('GET', '/unread/list');
$form = $crawler->filter('button[id=submit-filter]')->form(); $form = $crawler->filter('button[id=submit-filter]')->form();
$data = array( $data = [
'entry_filter[language]' => 'fr', 'entry_filter[language]' => 'fr',
); ];
$crawler = $client->submit($form, $data); $crawler = $client->submit($form, $data);
$this->assertCount(2, $crawler->filter('div[class=entry]')); $this->assertCount(2, $crawler->filter('div[class=entry]'));
$form = $crawler->filter('button[id=submit-filter]')->form(); $form = $crawler->filter('button[id=submit-filter]')->form();
$data = array( $data = [
'entry_filter[language]' => 'en', 'entry_filter[language]' => 'en',
); ];
$crawler = $client->submit($form, $data); $crawler = $client->submit($form, $data);
$this->assertCount(2, $crawler->filter('div[class=entry]')); $this->assertCount(2, $crawler->filter('div[class=entry]'));

View File

@ -34,17 +34,17 @@ class RssControllerTest extends WallabagCoreTestCase
public function dataForBadUrl() public function dataForBadUrl()
{ {
return array( return [
array( [
'/admin/YZIOAUZIAO/unread.xml', '/admin/YZIOAUZIAO/unread.xml',
), ],
array( [
'/wallace/YZIOAUZIAO/starred.xml', '/wallace/YZIOAUZIAO/starred.xml',
), ],
array( [
'/wallace/YZIOAUZIAO/archives.xml', '/wallace/YZIOAUZIAO/archives.xml',
), ],
); ];
} }
/** /**

View File

@ -13,7 +13,7 @@ class SecurityControllerTest extends WallabagCoreTestCase
$client->followRedirects(); $client->followRedirects();
$crawler = $client->request('GET', '/config'); $crawler = $client->request('GET', '/config');
$this->assertContains('config.form_rss.description', $crawler->filter('body')->extract(array('_text'))[0]); $this->assertContains('config.form_rss.description', $crawler->filter('body')->extract(['_text'])[0]);
} }
public function testLoginWith2Factor() public function testLoginWith2Factor()
@ -38,7 +38,7 @@ class SecurityControllerTest extends WallabagCoreTestCase
$this->logInAs('admin'); $this->logInAs('admin');
$crawler = $client->request('GET', '/config'); $crawler = $client->request('GET', '/config');
$this->assertContains('scheb_two_factor.trusted', $crawler->filter('body')->extract(array('_text'))[0]); $this->assertContains('scheb_two_factor.trusted', $crawler->filter('body')->extract(['_text'])[0]);
// restore user // restore user
$user = $em $user = $em

View File

@ -32,9 +32,9 @@ class TagControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('form[name=tag]')->form(); $form = $crawler->filter('form[name=tag]')->form();
$data = array( $data = [
'tag[label]' => $this->tagName, 'tag[label]' => $this->tagName,
); ];
$client->submit($form, $data); $client->submit($form, $data);
$this->assertEquals(302, $client->getResponse()->getStatusCode()); $this->assertEquals(302, $client->getResponse()->getStatusCode());
@ -53,9 +53,9 @@ class TagControllerTest extends WallabagCoreTestCase
$this->assertEquals(1, count($newEntry->getTags())); $this->assertEquals(1, count($newEntry->getTags()));
# tag already exists but still not assigned to this entry # tag already exists but still not assigned to this entry
$data = array( $data = [
'tag[label]' => 'foo', 'tag[label]' => 'foo',
); ];
$client->submit($form, $data); $client->submit($form, $data);
$this->assertEquals(302, $client->getResponse()->getStatusCode()); $this->assertEquals(302, $client->getResponse()->getStatusCode());
@ -82,9 +82,9 @@ class TagControllerTest extends WallabagCoreTestCase
$form = $crawler->filter('form[name=tag]')->form(); $form = $crawler->filter('form[name=tag]')->form();
$data = array( $data = [
'tag[label]' => 'foo2, bar2', 'tag[label]' => 'foo2, bar2',
); ];
$client->submit($form, $data); $client->submit($form, $data);
$this->assertEquals(302, $client->getResponse()->getStatusCode()); $this->assertEquals(302, $client->getResponse()->getStatusCode());

View File

@ -18,12 +18,12 @@ class StringToListTransformerTest extends \PHPUnit_Framework_TestCase
public function transformProvider() public function transformProvider()
{ {
return array( return [
array(null, ''), [null, ''],
array(array(), ''), [[], ''],
array(array('single value'), 'single value'), [['single value'], 'single value'],
array(array('first value', 'second value'), 'first value,second value'), [['first value', 'second value'], 'first value,second value'],
); ];
} }
/** /**
@ -38,13 +38,13 @@ class StringToListTransformerTest extends \PHPUnit_Framework_TestCase
public function reverseTransformProvider() public function reverseTransformProvider()
{ {
return array( return [
array(null, null), [null, null],
array('', array()), ['', []],
array('single value', array('single value')), ['single value', ['single value']],
array('first value,second value', array('first value', 'second value')), ['first value,second value', ['first value', 'second value']],
array('first value, second value', array('first value', 'second value')), ['first value, second value', ['first value', 'second value']],
array('first value, , second value', array('first value', 'second value')), ['first value, , second value', ['first value', 'second value']],
); ];
} }
} }

View File

@ -17,19 +17,19 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
->method('tag'); ->method('tag');
$graby = $this->getMockBuilder('Graby\Graby') $graby = $this->getMockBuilder('Graby\Graby')
->setMethods(array('fetchContent')) ->setMethods(['fetchContent'])
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$graby->expects($this->any()) $graby->expects($this->any())
->method('fetchContent') ->method('fetchContent')
->willReturn(array( ->willReturn([
'html' => false, 'html' => false,
'title' => '', 'title' => '',
'url' => '', 'url' => '',
'content_type' => '', 'content_type' => '',
'language' => '', 'language' => '',
)); ]);
$proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger());
$entry = $proxy->updateEntry(new Entry(new User()), 'http://user@:80'); $entry = $proxy->updateEntry(new Entry(new User()), 'http://user@:80');
@ -51,19 +51,19 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
->method('tag'); ->method('tag');
$graby = $this->getMockBuilder('Graby\Graby') $graby = $this->getMockBuilder('Graby\Graby')
->setMethods(array('fetchContent')) ->setMethods(['fetchContent'])
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$graby->expects($this->any()) $graby->expects($this->any())
->method('fetchContent') ->method('fetchContent')
->willReturn(array( ->willReturn([
'html' => false, 'html' => false,
'title' => '', 'title' => '',
'url' => '', 'url' => '',
'content_type' => '', 'content_type' => '',
'language' => '', 'language' => '',
)); ]);
$proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger());
$entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0');
@ -85,23 +85,23 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
->method('tag'); ->method('tag');
$graby = $this->getMockBuilder('Graby\Graby') $graby = $this->getMockBuilder('Graby\Graby')
->setMethods(array('fetchContent')) ->setMethods(['fetchContent'])
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$graby->expects($this->any()) $graby->expects($this->any())
->method('fetchContent') ->method('fetchContent')
->willReturn(array( ->willReturn([
'html' => false, 'html' => false,
'title' => '', 'title' => '',
'url' => '', 'url' => '',
'content_type' => '', 'content_type' => '',
'language' => '', 'language' => '',
'open_graph' => array( 'open_graph' => [
'og_title' => 'my title', 'og_title' => 'my title',
'og_description' => 'desc', 'og_description' => 'desc',
), ],
)); ]);
$proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger());
$entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io'); $entry = $proxy->updateEntry(new Entry(new User()), 'http://domain.io');
@ -123,24 +123,24 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
->method('tag'); ->method('tag');
$graby = $this->getMockBuilder('Graby\Graby') $graby = $this->getMockBuilder('Graby\Graby')
->setMethods(array('fetchContent')) ->setMethods(['fetchContent'])
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
$graby->expects($this->any()) $graby->expects($this->any())
->method('fetchContent') ->method('fetchContent')
->willReturn(array( ->willReturn([
'html' => str_repeat('this is my content', 325), 'html' => str_repeat('this is my content', 325),
'title' => 'this is my title', 'title' => 'this is my title',
'url' => 'http://1.1.1.1', 'url' => 'http://1.1.1.1',
'content_type' => 'text/html', 'content_type' => 'text/html',
'language' => 'fr', 'language' => 'fr',
'open_graph' => array( 'open_graph' => [
'og_title' => 'my OG title', 'og_title' => 'my OG title',
'og_description' => 'OG desc', 'og_description' => 'OG desc',
'og_image' => 'http://3.3.3.3/cover.jpg', 'og_image' => 'http://3.3.3.3/cover.jpg',
), ],
)); ]);
$proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger()); $proxy = new ContentProxy($graby, $tagger, $this->getTagRepositoryMock(), $this->getLogger());
$entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0'); $entry = $proxy->updateEntry(new Entry(new User()), 'http://0.0.0.0');
@ -217,7 +217,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
$entry = new Entry(new User()); $entry = new Entry(new User());
$proxy->assignTagsToEntry($entry, array(' tag1', 'tag2 ')); $proxy->assignTagsToEntry($entry, [' tag1', 'tag2 ']);
$this->assertCount(2, $entry->getTags()); $this->assertCount(2, $entry->getTags());
$this->assertEquals('tag1', $entry->getTags()[0]->getLabel()); $this->assertEquals('tag1', $entry->getTags()[0]->getLabel());
@ -253,7 +253,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
$entry = new Entry(new User()); $entry = new Entry(new User());
$proxy->assignTagsToEntry($entry, array()); $proxy->assignTagsToEntry($entry, []);
$this->assertCount(0, $entry->getTags()); $this->assertCount(0, $entry->getTags());
} }
@ -299,7 +299,7 @@ class ContentProxyTest extends \PHPUnit_Framework_TestCase
private function getTaggerMock() private function getTaggerMock()
{ {
return $this->getMockBuilder('Wallabag\CoreBundle\Helper\RuleBasedTagger') return $this->getMockBuilder('Wallabag\CoreBundle\Helper\RuleBasedTagger')
->setMethods(array('tag')) ->setMethods(['tag'])
->disableOriginalConstructor() ->disableOriginalConstructor()
->getMock(); ->getMock();
} }

View File

@ -36,7 +36,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
public function testTagWithNoMatchingRule() public function testTagWithNoMatchingRule()
{ {
$taggingRule = $this->getTaggingRule('rule as string', array('foo', 'bar')); $taggingRule = $this->getTaggingRule('rule as string', ['foo', 'bar']);
$user = $this->getUser([$taggingRule]); $user = $this->getUser([$taggingRule]);
$entry = new Entry($user); $entry = new Entry($user);
@ -53,7 +53,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
public function testTagWithAMatchingRule() public function testTagWithAMatchingRule()
{ {
$taggingRule = $this->getTaggingRule('rule as string', array('foo', 'bar')); $taggingRule = $this->getTaggingRule('rule as string', ['foo', 'bar']);
$user = $this->getUser([$taggingRule]); $user = $this->getUser([$taggingRule]);
$entry = new Entry($user); $entry = new Entry($user);
@ -74,8 +74,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
public function testTagWithAMixOfMatchingRules() public function testTagWithAMixOfMatchingRules()
{ {
$taggingRule = $this->getTaggingRule('bla bla', array('hey')); $taggingRule = $this->getTaggingRule('bla bla', ['hey']);
$otherTaggingRule = $this->getTaggingRule('rule as string', array('foo')); $otherTaggingRule = $this->getTaggingRule('rule as string', ['foo']);
$user = $this->getUser([$taggingRule, $otherTaggingRule]); $user = $this->getUser([$taggingRule, $otherTaggingRule]);
$entry = new Entry($user); $entry = new Entry($user);
@ -94,7 +94,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
public function testWhenTheTagExists() public function testWhenTheTagExists()
{ {
$taggingRule = $this->getTaggingRule('rule as string', array('foo')); $taggingRule = $this->getTaggingRule('rule as string', ['foo']);
$user = $this->getUser([$taggingRule]); $user = $this->getUser([$taggingRule]);
$entry = new Entry($user); $entry = new Entry($user);
$tag = new Tag(); $tag = new Tag();
@ -122,8 +122,8 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
public function testSameTagWithDifferentfMatchingRules() public function testSameTagWithDifferentfMatchingRules()
{ {
$taggingRule = $this->getTaggingRule('bla bla', array('hey')); $taggingRule = $this->getTaggingRule('bla bla', ['hey']);
$otherTaggingRule = $this->getTaggingRule('rule as string', array('hey')); $otherTaggingRule = $this->getTaggingRule('rule as string', ['hey']);
$user = $this->getUser([$taggingRule, $otherTaggingRule]); $user = $this->getUser([$taggingRule, $otherTaggingRule]);
$entry = new Entry($user); $entry = new Entry($user);
@ -142,7 +142,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
public function testTagAllEntriesForAUser() public function testTagAllEntriesForAUser()
{ {
$taggingRule = $this->getTaggingRule('bla bla', array('hey')); $taggingRule = $this->getTaggingRule('bla bla', ['hey']);
$user = $this->getUser([$taggingRule]); $user = $this->getUser([$taggingRule]);
@ -152,7 +152,7 @@ class RuleBasedTaggerTest extends \PHPUnit_Framework_TestCase
$this->rulerz $this->rulerz
->method('filter') ->method('filter')
->willReturn(array(new Entry($user), new Entry($user))); ->willReturn([new Entry($user), new Entry($user)]);
$entries = $this->tagger->tagAllForUser($user); $entries = $this->tagger->tagAllForUser($user);

View File

@ -15,7 +15,7 @@ use Wallabag\CoreBundle\Command\InstallCommand;
*/ */
class InstallCommandMock extends InstallCommand class InstallCommandMock extends InstallCommand
{ {
protected function runCommand($command, $parameters = array()) protected function runCommand($command, $parameters = [])
{ {
return $this; return $this;
} }

View File

@ -11,7 +11,7 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase
{ {
public function testSupportsWithNoRegistry() public function testSupportsWithNoRegistry()
{ {
$params = new ParamConverter(array()); $params = new ParamConverter([]);
$converter = new UsernameRssTokenConverter(); $converter = new UsernameRssTokenConverter();
$this->assertFalse($converter->supports($params)); $this->assertFalse($converter->supports($params));
@ -25,9 +25,9 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase
$registry->expects($this->once()) $registry->expects($this->once())
->method('getManagers') ->method('getManagers')
->will($this->returnValue(array())); ->will($this->returnValue([]));
$params = new ParamConverter(array()); $params = new ParamConverter([]);
$converter = new UsernameRssTokenConverter($registry); $converter = new UsernameRssTokenConverter($registry);
$this->assertFalse($converter->supports($params)); $this->assertFalse($converter->supports($params));
@ -41,9 +41,9 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase
$registry->expects($this->once()) $registry->expects($this->once())
->method('getManagers') ->method('getManagers')
->will($this->returnValue(array('default' => null))); ->will($this->returnValue(['default' => null]));
$params = new ParamConverter(array()); $params = new ParamConverter([]);
$converter = new UsernameRssTokenConverter($registry); $converter = new UsernameRssTokenConverter($registry);
$this->assertFalse($converter->supports($params)); $this->assertFalse($converter->supports($params));
@ -74,14 +74,14 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase
$registry->expects($this->once()) $registry->expects($this->once())
->method('getManagers') ->method('getManagers')
->will($this->returnValue(array('default' => null))); ->will($this->returnValue(['default' => null]));
$registry->expects($this->once()) $registry->expects($this->once())
->method('getManagerForClass') ->method('getManagerForClass')
->with('superclass') ->with('superclass')
->will($this->returnValue($em)); ->will($this->returnValue($em));
$params = new ParamConverter(array('class' => 'superclass')); $params = new ParamConverter(['class' => 'superclass']);
$converter = new UsernameRssTokenConverter($registry); $converter = new UsernameRssTokenConverter($registry);
$this->assertFalse($converter->supports($params)); $this->assertFalse($converter->supports($params));
@ -112,14 +112,14 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase
$registry->expects($this->once()) $registry->expects($this->once())
->method('getManagers') ->method('getManagers')
->will($this->returnValue(array('default' => null))); ->will($this->returnValue(['default' => null]));
$registry->expects($this->once()) $registry->expects($this->once())
->method('getManagerForClass') ->method('getManagerForClass')
->with('WallabagUserBundle:User') ->with('WallabagUserBundle:User')
->will($this->returnValue($em)); ->will($this->returnValue($em));
$params = new ParamConverter(array('class' => 'WallabagUserBundle:User')); $params = new ParamConverter(['class' => 'WallabagUserBundle:User']);
$converter = new UsernameRssTokenConverter($registry); $converter = new UsernameRssTokenConverter($registry);
$this->assertTrue($converter->supports($params)); $this->assertTrue($converter->supports($params));
@ -131,7 +131,7 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase
*/ */
public function testApplyEmptyRequest() public function testApplyEmptyRequest()
{ {
$params = new ParamConverter(array()); $params = new ParamConverter([]);
$converter = new UsernameRssTokenConverter(); $converter = new UsernameRssTokenConverter();
$converter->apply(new Request(), $params); $converter->apply(new Request(), $params);
@ -170,9 +170,9 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase
->with('WallabagUserBundle:User') ->with('WallabagUserBundle:User')
->will($this->returnValue($em)); ->will($this->returnValue($em));
$params = new ParamConverter(array('class' => 'WallabagUserBundle:User')); $params = new ParamConverter(['class' => 'WallabagUserBundle:User']);
$converter = new UsernameRssTokenConverter($registry); $converter = new UsernameRssTokenConverter($registry);
$request = new Request(array(), array(), array('username' => 'test', 'token' => 'test')); $request = new Request([], [], ['username' => 'test', 'token' => 'test']);
$converter->apply($request, $params); $converter->apply($request, $params);
} }
@ -208,9 +208,9 @@ class UsernameRssTokenConverterTest extends \PHPUnit_Framework_TestCase
->with('WallabagUserBundle:User') ->with('WallabagUserBundle:User')
->will($this->returnValue($em)); ->will($this->returnValue($em));
$params = new ParamConverter(array('class' => 'WallabagUserBundle:User', 'name' => 'user')); $params = new ParamConverter(['class' => 'WallabagUserBundle:User', 'name' => 'user']);
$converter = new UsernameRssTokenConverter($registry); $converter = new UsernameRssTokenConverter($registry);
$request = new Request(array(), array(), array('username' => 'test', 'token' => 'test')); $request = new Request([], [], ['username' => 'test', 'token' => 'test']);
$converter->apply($request, $params); $converter->apply($request, $params);

View File

@ -11,23 +11,23 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase
{ {
public function dataForPrefix() public function dataForPrefix()
{ {
return array( return [
array('wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()), ['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()],
array('wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '`wallabag_user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()), ['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '`wallabag_user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()],
array('wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()), ['wallabag_', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'wallabag_user', '"wallabag_user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()],
array('wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()), ['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()],
array('wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\MySqlPlatform()), ['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\MySqlPlatform()],
array('wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\SqlitePlatform()), ['wallabag_', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'wallabag_user', 'wallabag_user', new \Doctrine\DBAL\Platforms\SqlitePlatform()],
array('', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()), ['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()],
array('', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '`user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()), ['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '`user`', new \Doctrine\DBAL\Platforms\MySqlPlatform()],
array('', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()), ['', 'Wallabag\UserBundle\Entity\User', '`user`', 'user', 'user', '"user"', new \Doctrine\DBAL\Platforms\SqlitePlatform()],
array('', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()), ['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\PostgreSqlPlatform()],
array('', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\MySqlPlatform()), ['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\MySqlPlatform()],
array('', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\SqlitePlatform()), ['', 'Wallabag\UserBundle\Entity\User', 'user', 'user', 'user', 'user', new \Doctrine\DBAL\Platforms\SqlitePlatform()],
); ];
} }
/** /**
@ -42,7 +42,7 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase
$subscriber = new TablePrefixSubscriber($prefix); $subscriber = new TablePrefixSubscriber($prefix);
$metaClass = new ClassMetadata($entityName); $metaClass = new ClassMetadata($entityName);
$metaClass->setPrimaryTable(array('name' => $tableName)); $metaClass->setPrimaryTable(['name' => $tableName]);
$metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em);
@ -64,7 +64,7 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase
->getMock(); ->getMock();
$metaClass = new ClassMetadata($entityName); $metaClass = new ClassMetadata($entityName);
$metaClass->setPrimaryTable(array('name' => $tableName)); $metaClass->setPrimaryTable(['name' => $tableName]);
$metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em);
@ -88,18 +88,18 @@ class TablePrefixSubscriberTest extends \PHPUnit_Framework_TestCase
$subscriber = new TablePrefixSubscriber('yo_'); $subscriber = new TablePrefixSubscriber('yo_');
$metaClass = new ClassMetadata('Wallabag\UserBundle\Entity\Entry'); $metaClass = new ClassMetadata('Wallabag\UserBundle\Entity\Entry');
$metaClass->setPrimaryTable(array('name' => 'entry')); $metaClass->setPrimaryTable(['name' => 'entry']);
$metaClass->mapManyToMany(array( $metaClass->mapManyToMany([
'fieldName' => 'tags', 'fieldName' => 'tags',
'joinTable' => array('name' => null, 'schema' => null), 'joinTable' => ['name' => null, 'schema' => null],
'targetEntity' => 'Tag', 'targetEntity' => 'Tag',
'mappedBy' => null, 'mappedBy' => null,
'inversedBy' => 'entries', 'inversedBy' => 'entries',
'cascade' => array('persist'), 'cascade' => ['persist'],
'indexBy' => null, 'indexBy' => null,
'orphanRemoval' => false, 'orphanRemoval' => false,
'fetch' => 2, 'fetch' => 2,
)); ]);
$metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em); $metaDataEvent = new LoadClassMetadataEventArgs($metaClass, $em);

View File

@ -24,10 +24,10 @@ abstract class WallabagCoreTestCase extends WebTestCase
{ {
$crawler = $this->client->request('GET', '/login'); $crawler = $this->client->request('GET', '/login');
$form = $crawler->filter('button[type=submit]')->form(); $form = $crawler->filter('button[type=submit]')->form();
$data = array( $data = [
'_username' => $username, '_username' => $username,
'_password' => 'mypassword', '_password' => 'mypassword',
); ];
$this->client->submit($form, $data); $this->client->submit($form, $data);
} }

View File

@ -16,7 +16,7 @@ class Utils
$token = substr(base64_encode(random_bytes($length)), 0, $length); $token = substr(base64_encode(random_bytes($length)), 0, $length);
// remove character which can broken the url // remove character which can broken the url
return str_replace(array('+', '/'), '', $token); return str_replace(['+', '/'], '', $token);
} }
/** /**

View File

@ -6,9 +6,9 @@ class WallabagExtension extends \Twig_Extension
{ {
public function getFilters() public function getFilters()
{ {
return array( return [
new \Twig_SimpleFilter('removeWww', array($this, 'removeWww')), new \Twig_SimpleFilter('removeWww', [$this, 'removeWww']),
); ];
} }
public function removeWww($url) public function removeWww($url)

View File

@ -17,10 +17,10 @@ class PocketController extends Controller
{ {
$pocket = $this->get('wallabag_import.pocket.import'); $pocket = $this->get('wallabag_import.pocket.import');
$form = $this->createFormBuilder($pocket) $form = $this->createFormBuilder($pocket)
->add('mark_as_read', CheckboxType::class, array( ->add('mark_as_read', CheckboxType::class, [
'label' => 'import.form.mark_as_read_label', 'label' => 'import.form.mark_as_read_label',
'required' => false, 'required' => false,
)) ])
->getForm(); ->getForm();
return $this->render('WallabagImportBundle:Pocket:index.html.twig', [ return $this->render('WallabagImportBundle:Pocket:index.html.twig', [
@ -36,7 +36,7 @@ class PocketController extends Controller
public function authAction(Request $request) public function authAction(Request $request)
{ {
$requestToken = $this->get('wallabag_import.pocket.import') $requestToken = $this->get('wallabag_import.pocket.import')
->getRequestToken($this->generateUrl('import', array(), UrlGeneratorInterface::ABSOLUTE_URL)); ->getRequestToken($this->generateUrl('import', [], UrlGeneratorInterface::ABSOLUTE_URL));
if (false === $requestToken) { if (false === $requestToken) {
$this->get('session')->getFlashBag()->add( $this->get('session')->getFlashBag()->add(
@ -51,7 +51,7 @@ class PocketController extends Controller
$this->get('session')->set('mark_as_read', $request->request->get('form')['mark_as_read']); $this->get('session')->set('mark_as_read', $request->request->get('form')['mark_as_read']);
return $this->redirect( return $this->redirect(
'https://getpocket.com/auth/authorize?request_token='.$requestToken.'&redirect_uri='.$this->generateUrl('import_pocket_callback', array(), UrlGeneratorInterface::ABSOLUTE_URL), 'https://getpocket.com/auth/authorize?request_token='.$requestToken.'&redirect_uri='.$this->generateUrl('import_pocket_callback', [], UrlGeneratorInterface::ABSOLUTE_URL),
301 301
); );
} }
@ -79,10 +79,10 @@ class PocketController extends Controller
if (true === $pocket->setMarkAsRead($markAsRead)->import()) { if (true === $pocket->setMarkAsRead($markAsRead)->import()) {
$summary = $pocket->getSummary(); $summary = $pocket->getSummary();
$message = $this->get('translator')->trans('flashes.import.notice.summary', array( $message = $this->get('translator')->trans('flashes.import.notice.summary', [
'%imported%' => $summary['imported'], '%imported%' => $summary['imported'],
'%skipped%' => $summary['skipped'], '%skipped%' => $summary['skipped'],
)); ]);
} }
$this->get('session')->getFlashBag()->add( $this->get('session')->getFlashBag()->add(

View File

@ -55,10 +55,10 @@ abstract class WallabagController extends Controller
if (true === $res) { if (true === $res) {
$summary = $wallabag->getSummary(); $summary = $wallabag->getSummary();
$message = $this->get('translator')->trans('flashes.import.notice.summary', array( $message = $this->get('translator')->trans('flashes.import.notice.summary', [
'%imported%' => $summary['imported'], '%imported%' => $summary['imported'],
'%skipped%' => $summary['skipped'], '%skipped%' => $summary['skipped'],
)); ]);
unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name); unlink($this->getParameter('wallabag_import.resource_dir').'/'.$name);
} }

View File

@ -13,16 +13,16 @@ class UploadImportType extends AbstractType
public function buildForm(FormBuilderInterface $builder, array $options) public function buildForm(FormBuilderInterface $builder, array $options)
{ {
$builder $builder
->add('file', FileType::class, array( ->add('file', FileType::class, [
'label' => 'import.form.file_label', 'label' => 'import.form.file_label',
)) ])
->add('mark_as_read', CheckboxType::class, array( ->add('mark_as_read', CheckboxType::class, [
'label' => 'import.form.mark_as_read_label', 'label' => 'import.form.mark_as_read_label',
'required' => false, 'required' => false,
)) ])
->add('save', SubmitType::class, array( ->add('save', SubmitType::class, [
'label' => 'import.form.save_label', 'label' => 'import.form.save_label',
)) ])
; ;
} }

View File

@ -29,9 +29,9 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
$file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1.json', 'wallabag-v1.json'); $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1.json', 'wallabag-v1.json');
$data = array( $data = [
'upload_import_file[file]' => $file, 'upload_import_file[file]' => $file,
); ];
$client->submit($form, $data); $client->submit($form, $data);
@ -54,7 +54,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
$this->assertTrue($content->getTags()->contains($tag)); $this->assertTrue($content->getTags()->contains($tag));
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertContains('flashes.import.notice.summary', $body[0]); $this->assertContains('flashes.import.notice.summary', $body[0]);
} }
@ -68,10 +68,10 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
$file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1-read.json', 'wallabag-v1-read.json'); $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v1-read.json', 'wallabag-v1-read.json');
$data = array( $data = [
'upload_import_file[file]' => $file, 'upload_import_file[file]' => $file,
'upload_import_file[mark_as_read]' => 1, 'upload_import_file[mark_as_read]' => 1,
); ];
$client->submit($form, $data); $client->submit($form, $data);
@ -99,7 +99,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
$this->assertTrue($content2->isArchived()); $this->assertTrue($content2->isArchived());
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertContains('flashes.import.notice.summary', $body[0]); $this->assertContains('flashes.import.notice.summary', $body[0]);
} }
@ -113,9 +113,9 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
$file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt');
$data = array( $data = [
'upload_import_file[file]' => $file, 'upload_import_file[file]' => $file,
); ];
$client->submit($form, $data); $client->submit($form, $data);
@ -123,7 +123,7 @@ class WallabagV1ControllerTest extends WallabagCoreTestCase
$crawler = $client->followRedirect(); $crawler = $client->followRedirect();
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertContains('flashes.import.notice.failed', $body[0]); $this->assertContains('flashes.import.notice.failed', $body[0]);
} }
} }

View File

@ -29,9 +29,9 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
$file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v2.json', 'wallabag-v2.json'); $file = new UploadedFile(__DIR__.'/../fixtures/wallabag-v2.json', 'wallabag-v2.json');
$data = array( $data = [
'upload_import_file[file]' => $file, 'upload_import_file[file]' => $file,
); ];
$client->submit($form, $data); $client->submit($form, $data);
@ -39,7 +39,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
$crawler = $client->followRedirect(); $crawler = $client->followRedirect();
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertContains('flashes.import.notice.summary', $body[0]); $this->assertContains('flashes.import.notice.summary', $body[0]);
$content = $client->getContainer() $content = $client->getContainer()
@ -79,9 +79,9 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
$file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt'); $file = new UploadedFile(__DIR__.'/../fixtures/test.txt', 'test.txt');
$data = array( $data = [
'upload_import_file[file]' => $file, 'upload_import_file[file]' => $file,
); ];
$client->submit($form, $data); $client->submit($form, $data);
@ -89,7 +89,7 @@ class WallabagV2ControllerTest extends WallabagCoreTestCase
$crawler = $client->followRedirect(); $crawler = $client->followRedirect();
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(array('_text'))); $this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertContains('flashes.import.notice.failed', $body[0]); $this->assertContains('flashes.import.notice.failed', $body[0]);
} }
} }

View File

@ -25,7 +25,7 @@ class ImportCompilerPassTest extends \PHPUnit_Framework_TestCase
$container $container
->register('foo') ->register('foo')
->addTag('wallabag_import.import', array('alias' => 'pocket')) ->addTag('wallabag_import.import', ['alias' => 'pocket'])
; ;
$this->process($container); $this->process($container);

View File

@ -73,7 +73,7 @@ class PocketImportTest extends \PHPUnit_Framework_TestCase
); );
$this->logHandler = new TestHandler(); $this->logHandler = new TestHandler();
$logger = new Logger('test', array($this->logHandler)); $logger = new Logger('test', [$this->logHandler]);
$pocket->setLogger($logger); $pocket->setLogger($logger);
return $pocket; return $pocket;

View File

@ -30,7 +30,7 @@ class WallabagV1ImportTest extends \PHPUnit_Framework_TestCase
$wallabag = new WallabagV1Import($this->em, $this->contentProxy); $wallabag = new WallabagV1Import($this->em, $this->contentProxy);
$this->logHandler = new TestHandler(); $this->logHandler = new TestHandler();
$logger = new Logger('test', array($this->logHandler)); $logger = new Logger('test', [$this->logHandler]);
$wallabag->setLogger($logger); $wallabag->setLogger($logger);
if (false === $unsetUser) { if (false === $unsetUser) {

View File

@ -30,7 +30,7 @@ class WallabagV2ImportTest extends \PHPUnit_Framework_TestCase
$wallabag = new WallabagV2Import($this->em, $this->contentProxy); $wallabag = new WallabagV2Import($this->em, $this->contentProxy);
$this->logHandler = new TestHandler(); $this->logHandler = new TestHandler();
$logger = new Logger('test', array($this->logHandler)); $logger = new Logger('test', [$this->logHandler]);
$wallabag->setLogger($logger); $wallabag->setLogger($logger);
if (false === $unsetUser) { if (false === $unsetUser) {

View File

@ -88,7 +88,7 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf
{ {
parent::__construct(); parent::__construct();
$this->entries = new ArrayCollection(); $this->entries = new ArrayCollection();
$this->roles = array('ROLE_USER'); $this->roles = ['ROLE_USER'];
} }
/** /**

View File

@ -27,9 +27,9 @@ class PasswordResettingListener implements EventSubscriberInterface
*/ */
public static function getSubscribedEvents() public static function getSubscribedEvents()
{ {
return array( return [
FOSUserEvents::RESETTING_RESET_SUCCESS => 'onPasswordResettingSuccess', FOSUserEvents::RESETTING_RESET_SUCCESS => 'onPasswordResettingSuccess',
); ];
} }
public function onPasswordResettingSuccess(FormEvent $event) public function onPasswordResettingSuccess(FormEvent $event)

View File

@ -82,7 +82,7 @@ class AuthCodeMailer implements AuthCodeMailerInterface
{ {
$template = $this->twig->loadTemplate('WallabagUserBundle:TwoFactor:email_auth_code.html.twig'); $template = $this->twig->loadTemplate('WallabagUserBundle:TwoFactor:email_auth_code.html.twig');
$subject = $template->renderBlock('subject', array()); $subject = $template->renderBlock('subject', []);
$bodyHtml = $template->renderBlock('body_html', [ $bodyHtml = $template->renderBlock('body_html', [
'user' => $user->getName(), 'user' => $user->getName(),
'code' => $user->getEmailAuthCode(), 'code' => $user->getEmailAuthCode(),

View File

@ -43,7 +43,7 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase
{% block body_text %}text body {{ support_url }}{% endblock %} {% block body_text %}text body {{ support_url }}{% endblock %}
TWIG; TWIG;
$this->twig = new \Twig_Environment(new \Twig_Loader_Array(array('WallabagUserBundle:TwoFactor:email_auth_code.html.twig' => $twigTemplate))); $this->twig = new \Twig_Environment(new \Twig_Loader_Array(['WallabagUserBundle:TwoFactor:email_auth_code.html.twig' => $twigTemplate]));
$this->config = $this->getMockBuilder('Craue\ConfigBundle\Util\Config') $this->config = $this->getMockBuilder('Craue\ConfigBundle\Util\Config')
->disableOriginalConstructor() ->disableOriginalConstructor()
@ -76,7 +76,7 @@ TWIG;
$msg = $this->spool->getMessages()[0]; $msg = $this->spool->getMessages()[0];
$this->assertArrayHasKey('test@wallabag.io', $msg->getTo()); $this->assertArrayHasKey('test@wallabag.io', $msg->getTo());
$this->assertEquals(array('nobody@test.io' => 'wallabag test'), $msg->getFrom()); $this->assertEquals(['nobody@test.io' => 'wallabag test'], $msg->getFrom());
$this->assertEquals('subject', $msg->getSubject()); $this->assertEquals('subject', $msg->getSubject());
$this->assertContains('text body http://0.0.0.0/support', $msg->toString()); $this->assertContains('text body http://0.0.0.0/support', $msg->toString());
$this->assertContains('html body 666666', $msg->toString()); $this->assertContains('html body 666666', $msg->toString());