aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.travis.yml2
-rw-r--r--app/config/routing.yml10
-rw-r--r--composer.json3
-rw-r--r--composer.lock144
-rw-r--r--phpunit.xml.dist5
-rw-r--r--src/Wallabag/ApiBundle/Controller/WallabagRestController.php4
-rw-r--r--src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php6
-rw-r--r--src/Wallabag/CoreBundle/Command/InstallCommand.php45
-rw-r--r--src/Wallabag/CoreBundle/Controller/ConfigController.php16
-rw-r--r--src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php14
-rw-r--r--src/Wallabag/CoreBundle/Resources/config/services.yml2
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig10
-rw-r--r--src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig14
-rw-r--r--src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php72
14 files changed, 199 insertions, 148 deletions
diff --git a/.travis.yml b/.travis.yml
index d5355820..df3a5c72 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -51,7 +51,7 @@ before_script:
51 51
52script: 52script:
53 - ant prepare-$DB 53 - ant prepare-$DB
54 - bin/phpunit --exclude-group command-doctrine -v 54 - SYMFONY_DEPRECATIONS_HELPER=weak bin/phpunit --exclude-group command-doctrine -v
55 55
56# after_script: 56# after_script:
57 # - | 57 # - |
diff --git a/app/config/routing.yml b/app/config/routing.yml
index af3e32b1..0f7b61fb 100644
--- a/app/config/routing.yml
+++ b/app/config/routing.yml
@@ -1,10 +1,10 @@
1wallabag_api: 1wallabag_api:
2 resource: "@WallabagApiBundle/Resources/config/routing.yml" 2 resource: "@WallabagApiBundle/Resources/config/routing.yml"
3 prefix: / 3 prefix: /
4 4
5app: 5app:
6 resource: @WallabagCoreBundle/Controller/ 6 resource: @WallabagCoreBundle/Controller/
7 type: annotation 7 type: annotation
8 8
9doc-api: 9doc-api:
10 resource: "@NelmioApiDocBundle/Resources/config/routing.yml" 10 resource: "@NelmioApiDocBundle/Resources/config/routing.yml"
@@ -16,10 +16,10 @@ rest :
16 prefix : /api 16 prefix : /api
17 17
18homepage: 18homepage:
19 pattern: "/{page}" 19 path: "/{page}"
20 defaults: { _controller: WallabagCoreBundle:Entry:showUnread, page : 1 } 20 defaults: { _controller: WallabagCoreBundle:Entry:showUnread, page : 1 }
21 requirements: 21 requirements:
22 page: \d+ 22 page: \d+
23 23
24fos_user: 24fos_user:
25 resource: "@FOSUserBundle/Resources/config/routing/all.xml" 25 resource: "@FOSUserBundle/Resources/config/routing/all.xml"
diff --git a/composer.json b/composer.json
index e16de833..b8c936f0 100644
--- a/composer.json
+++ b/composer.json
@@ -60,7 +60,8 @@
60 "require-dev": { 60 "require-dev": {
61 "doctrine/doctrine-fixtures-bundle": "~2.2.0", 61 "doctrine/doctrine-fixtures-bundle": "~2.2.0",
62 "sensio/generator-bundle": "~2.5", 62 "sensio/generator-bundle": "~2.5",
63 "phpunit/phpunit": "~4.4" 63 "phpunit/phpunit": "~4.4",
64 "symfony/phpunit-bridge": "~2.7.0"
64 }, 65 },
65 "scripts": { 66 "scripts": {
66 "post-install-cmd": [ 67 "post-install-cmd": [
diff --git a/composer.lock b/composer.lock
index 368f9f95..ee6e483a 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,8 +4,8 @@
4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", 4 "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 "This file is @generated automatically" 5 "This file is @generated automatically"
6 ], 6 ],
7 "hash": "7fb67fafde0e24c1802714a2a47da5e1", 7 "hash": "01e7829e7ff2b39b288871661bb05e9a",
8 "content-hash": "372936ba75537d8422a8e63bd419c213", 8 "content-hash": "76830bc9c2cd6f600613c9eea7c0f1b1",
9 "packages": [ 9 "packages": [
10 { 10 {
11 "name": "doctrine/annotations", 11 "name": "doctrine/annotations",
@@ -77,16 +77,16 @@
77 }, 77 },
78 { 78 {
79 "name": "doctrine/cache", 79 "name": "doctrine/cache",
80 "version": "v1.5.0", 80 "version": "v1.5.1",
81 "source": { 81 "source": {
82 "type": "git", 82 "type": "git",
83 "url": "https://github.com/doctrine/cache.git", 83 "url": "https://github.com/doctrine/cache.git",
84 "reference": "eb8a73619af4f1c8711e2ce482f5de3643258a1f" 84 "reference": "2b9cec5a5e722010cbebc91713d4c11eaa064d5e"
85 }, 85 },
86 "dist": { 86 "dist": {
87 "type": "zip", 87 "type": "zip",
88 "url": "https://api.github.com/repos/doctrine/cache/zipball/eb8a73619af4f1c8711e2ce482f5de3643258a1f", 88 "url": "https://api.github.com/repos/doctrine/cache/zipball/2b9cec5a5e722010cbebc91713d4c11eaa064d5e",
89 "reference": "eb8a73619af4f1c8711e2ce482f5de3643258a1f", 89 "reference": "2b9cec5a5e722010cbebc91713d4c11eaa064d5e",
90 "shasum": "" 90 "shasum": ""
91 }, 91 },
92 "require": { 92 "require": {
@@ -143,7 +143,7 @@
143 "cache", 143 "cache",
144 "caching" 144 "caching"
145 ], 145 ],
146 "time": "2015-10-28 11:27:45" 146 "time": "2015-11-02 18:35:48"
147 }, 147 },
148 { 148 {
149 "name": "doctrine/collections", 149 "name": "doctrine/collections",
@@ -357,16 +357,16 @@
357 }, 357 },
358 { 358 {
359 "name": "doctrine/doctrine-bundle", 359 "name": "doctrine/doctrine-bundle",
360 "version": "v1.5.2", 360 "version": "1.6.0",
361 "source": { 361 "source": {
362 "type": "git", 362 "type": "git",
363 "url": "https://github.com/doctrine/DoctrineBundle.git", 363 "url": "https://github.com/doctrine/DoctrineBundle.git",
364 "reference": "d63be7eb9a95d46720f7d6badac4e5bc2bcff2e3" 364 "reference": "a5b3ba908ba68f3e14e42762a7b940fde65ed7da"
365 }, 365 },
366 "dist": { 366 "dist": {
367 "type": "zip", 367 "type": "zip",
368 "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/d63be7eb9a95d46720f7d6badac4e5bc2bcff2e3", 368 "url": "https://api.github.com/repos/doctrine/DoctrineBundle/zipball/a5b3ba908ba68f3e14e42762a7b940fde65ed7da",
369 "reference": "d63be7eb9a95d46720f7d6badac4e5bc2bcff2e3", 369 "reference": "a5b3ba908ba68f3e14e42762a7b940fde65ed7da",
370 "shasum": "" 370 "shasum": ""
371 }, 371 },
372 "require": { 372 "require": {
@@ -431,42 +431,42 @@
431 "orm", 431 "orm",
432 "persistence" 432 "persistence"
433 ], 433 ],
434 "time": "2015-08-31 14:47:06" 434 "time": "2015-11-04 21:33:02"
435 }, 435 },
436 { 436 {
437 "name": "doctrine/doctrine-cache-bundle", 437 "name": "doctrine/doctrine-cache-bundle",
438 "version": "v1.0.1", 438 "version": "1.2.1",
439 "target-dir": "Doctrine/Bundle/DoctrineCacheBundle",
440 "source": { 439 "source": {
441 "type": "git", 440 "type": "git",
442 "url": "https://github.com/doctrine/DoctrineCacheBundle.git", 441 "url": "https://github.com/doctrine/DoctrineCacheBundle.git",
443 "reference": "e4b6f810aa047f9cbfe41c3d6a3d7e83d7477a9d" 442 "reference": "3233bc78e222d528ca89a6a47d48d6f37888e95e"
444 }, 443 },
445 "dist": { 444 "dist": {
446 "type": "zip", 445 "type": "zip",
447 "url": "https://api.github.com/repos/doctrine/DoctrineCacheBundle/zipball/e4b6f810aa047f9cbfe41c3d6a3d7e83d7477a9d", 446 "url": "https://api.github.com/repos/doctrine/DoctrineCacheBundle/zipball/3233bc78e222d528ca89a6a47d48d6f37888e95e",
448 "reference": "e4b6f810aa047f9cbfe41c3d6a3d7e83d7477a9d", 447 "reference": "3233bc78e222d528ca89a6a47d48d6f37888e95e",
449 "shasum": "" 448 "shasum": ""
450 }, 449 },
451 "require": { 450 "require": {
452 "doctrine/cache": "~1.3", 451 "doctrine/cache": "^1.4.2",
453 "doctrine/inflector": "~1.0", 452 "doctrine/inflector": "~1.0",
454 "php": ">=5.3.2", 453 "php": ">=5.3.2",
455 "symfony/doctrine-bridge": "~2.2", 454 "symfony/doctrine-bridge": "~2.2|~3.0",
456 "symfony/framework-bundle": "~2.2", 455 "symfony/security-acl": "~2.3|~3.0"
457 "symfony/security": "~2.2"
458 }, 456 },
459 "require-dev": { 457 "require-dev": {
460 "instaclick/coding-standard": "~1.1", 458 "instaclick/coding-standard": "~1.1",
461 "instaclick/object-calisthenics-sniffs": "dev-master", 459 "instaclick/object-calisthenics-sniffs": "dev-master",
462 "instaclick/symfony2-coding-standard": "dev-remaster", 460 "instaclick/symfony2-coding-standard": "dev-remaster",
463 "phpunit/phpunit": "~3.7", 461 "phpunit/phpunit": "~4",
464 "satooshi/php-coveralls": "~0.6.1", 462 "satooshi/php-coveralls": "~0.6.1",
465 "squizlabs/php_codesniffer": "dev-master", 463 "squizlabs/php_codesniffer": "~1.5",
466 "symfony/console": "~2.2", 464 "symfony/console": "~2.2|~3.0",
467 "symfony/finder": "~2.2", 465 "symfony/finder": "~2.2|~3.0",
468 "symfony/validator": "~2.2", 466 "symfony/framework-bundle": "~2.2|~3.0",
469 "symfony/yaml": "~2.2" 467 "symfony/phpunit-bridge": "~2.7|~3.0",
468 "symfony/validator": "~2.2|~3.0",
469 "symfony/yaml": "~2.2|~3.0"
470 }, 470 },
471 "type": "symfony-bundle", 471 "type": "symfony-bundle",
472 "extra": { 472 "extra": {
@@ -475,8 +475,8 @@
475 } 475 }
476 }, 476 },
477 "autoload": { 477 "autoload": {
478 "psr-0": { 478 "psr-4": {
479 "Doctrine\\Bundle\\DoctrineCacheBundle": "" 479 "Doctrine\\Bundle\\DoctrineCacheBundle\\": ""
480 } 480 }
481 }, 481 },
482 "notification-url": "https://packagist.org/downloads/", 482 "notification-url": "https://packagist.org/downloads/",
@@ -509,26 +509,26 @@
509 "email": "fabien@symfony.com" 509 "email": "fabien@symfony.com"
510 } 510 }
511 ], 511 ],
512 "description": "Symfony2 Bundle for Doctrine Cache", 512 "description": "Symfony Bundle for Doctrine Cache",
513 "homepage": "http://www.doctrine-project.org", 513 "homepage": "http://www.doctrine-project.org",
514 "keywords": [ 514 "keywords": [
515 "cache", 515 "cache",
516 "caching" 516 "caching"
517 ], 517 ],
518 "time": "2014-11-28 09:43:36" 518 "time": "2015-11-05 13:48:27"
519 }, 519 },
520 { 520 {
521 "name": "doctrine/inflector", 521 "name": "doctrine/inflector",
522 "version": "v1.0.1", 522 "version": "v1.1.0",
523 "source": { 523 "source": {
524 "type": "git", 524 "type": "git",
525 "url": "https://github.com/doctrine/inflector.git", 525 "url": "https://github.com/doctrine/inflector.git",
526 "reference": "0bcb2e79d8571787f18b7eb036ed3d004908e604" 526 "reference": "90b2128806bfde671b6952ab8bea493942c1fdae"
527 }, 527 },
528 "dist": { 528 "dist": {
529 "type": "zip", 529 "type": "zip",
530 "url": "https://api.github.com/repos/doctrine/inflector/zipball/0bcb2e79d8571787f18b7eb036ed3d004908e604", 530 "url": "https://api.github.com/repos/doctrine/inflector/zipball/90b2128806bfde671b6952ab8bea493942c1fdae",
531 "reference": "0bcb2e79d8571787f18b7eb036ed3d004908e604", 531 "reference": "90b2128806bfde671b6952ab8bea493942c1fdae",
532 "shasum": "" 532 "shasum": ""
533 }, 533 },
534 "require": { 534 "require": {
@@ -540,7 +540,7 @@
540 "type": "library", 540 "type": "library",
541 "extra": { 541 "extra": {
542 "branch-alias": { 542 "branch-alias": {
543 "dev-master": "1.0.x-dev" 543 "dev-master": "1.1.x-dev"
544 } 544 }
545 }, 545 },
546 "autoload": { 546 "autoload": {
@@ -582,7 +582,7 @@
582 "singularize", 582 "singularize",
583 "string" 583 "string"
584 ], 584 ],
585 "time": "2014-12-20 21:24:13" 585 "time": "2015-11-06 14:35:42"
586 }, 586 },
587 { 587 {
588 "name": "doctrine/instantiator", 588 "name": "doctrine/instantiator",
@@ -1027,12 +1027,12 @@
1027 "source": { 1027 "source": {
1028 "type": "git", 1028 "type": "git",
1029 "url": "https://github.com/FriendsOfSymfony/FOSUserBundle.git", 1029 "url": "https://github.com/FriendsOfSymfony/FOSUserBundle.git",
1030 "reference": "d5b28c367d393f9d9fbc48c4138b2a74d51c0c83" 1030 "reference": "45d6f40178216a840885b4ca6d7de9e67068568a"
1031 }, 1031 },
1032 "dist": { 1032 "dist": {
1033 "type": "zip", 1033 "type": "zip",
1034 "url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/d5b28c367d393f9d9fbc48c4138b2a74d51c0c83", 1034 "url": "https://api.github.com/repos/FriendsOfSymfony/FOSUserBundle/zipball/45d6f40178216a840885b4ca6d7de9e67068568a",
1035 "reference": "d5b28c367d393f9d9fbc48c4138b2a74d51c0c83", 1035 "reference": "45d6f40178216a840885b4ca6d7de9e67068568a",
1036 "shasum": "" 1036 "shasum": ""
1037 }, 1037 },
1038 "require": { 1038 "require": {
@@ -1086,7 +1086,7 @@
1086 "keywords": [ 1086 "keywords": [
1087 "User management" 1087 "User management"
1088 ], 1088 ],
1089 "time": "2015-09-15 13:15:07" 1089 "time": "2015-11-03 10:24:23"
1090 }, 1090 },
1091 { 1091 {
1092 "name": "guzzlehttp/guzzle", 1092 "name": "guzzlehttp/guzzle",
@@ -3437,16 +3437,16 @@
3437 }, 3437 },
3438 { 3438 {
3439 "name": "twig/twig", 3439 "name": "twig/twig",
3440 "version": "v1.23.0", 3440 "version": "v1.23.1",
3441 "source": { 3441 "source": {
3442 "type": "git", 3442 "type": "git",
3443 "url": "https://github.com/twigphp/Twig.git", 3443 "url": "https://github.com/twigphp/Twig.git",
3444 "reference": "5868cd822fd6cf626d5f805439575f9c323cee2a" 3444 "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6"
3445 }, 3445 },
3446 "dist": { 3446 "dist": {
3447 "type": "zip", 3447 "type": "zip",
3448 "url": "https://api.github.com/repos/twigphp/Twig/zipball/5868cd822fd6cf626d5f805439575f9c323cee2a", 3448 "url": "https://api.github.com/repos/twigphp/Twig/zipball/d9b6333ae8dd2c8e3fd256e127548def0bc614c6",
3449 "reference": "5868cd822fd6cf626d5f805439575f9c323cee2a", 3449 "reference": "d9b6333ae8dd2c8e3fd256e127548def0bc614c6",
3450 "shasum": "" 3450 "shasum": ""
3451 }, 3451 },
3452 "require": { 3452 "require": {
@@ -3494,7 +3494,7 @@
3494 "keywords": [ 3494 "keywords": [
3495 "templating" 3495 "templating"
3496 ], 3496 ],
3497 "time": "2015-10-29 23:29:01" 3497 "time": "2015-11-05 12:49:06"
3498 }, 3498 },
3499 { 3499 {
3500 "name": "willdurand/hateoas", 3500 "name": "willdurand/hateoas",
@@ -4713,6 +4713,58 @@
4713 ], 4713 ],
4714 "description": "This bundle generates code for you", 4714 "description": "This bundle generates code for you",
4715 "time": "2015-03-17 06:36:52" 4715 "time": "2015-03-17 06:36:52"
4716 },
4717 {
4718 "name": "symfony/phpunit-bridge",
4719 "version": "v2.7.6",
4720 "source": {
4721 "type": "git",
4722 "url": "https://github.com/symfony/phpunit-bridge.git",
4723 "reference": "896bbd1742a6ecd2f7904167bdb6bf88eb6cfbe4"
4724 },
4725 "dist": {
4726 "type": "zip",
4727 "url": "https://api.github.com/repos/symfony/phpunit-bridge/zipball/896bbd1742a6ecd2f7904167bdb6bf88eb6cfbe4",
4728 "reference": "896bbd1742a6ecd2f7904167bdb6bf88eb6cfbe4",
4729 "shasum": ""
4730 },
4731 "require": {
4732 "php": ">=5.3.3"
4733 },
4734 "suggest": {
4735 "symfony/debug": "For tracking deprecated interfaces usages at runtime with DebugClassLoader"
4736 },
4737 "type": "symfony-bridge",
4738 "extra": {
4739 "branch-alias": {
4740 "dev-master": "2.7-dev"
4741 }
4742 },
4743 "autoload": {
4744 "files": [
4745 "bootstrap.php"
4746 ],
4747 "psr-4": {
4748 "Symfony\\Bridge\\PhpUnit\\": ""
4749 }
4750 },
4751 "notification-url": "https://packagist.org/downloads/",
4752 "license": [
4753 "MIT"
4754 ],
4755 "authors": [
4756 {
4757 "name": "Nicolas Grekas",
4758 "email": "p@tchwork.com"
4759 },
4760 {
4761 "name": "Symfony Community",
4762 "homepage": "https://symfony.com/contributors"
4763 }
4764 ],
4765 "description": "Symfony PHPUnit Bridge",
4766 "homepage": "https://symfony.com",
4767 "time": "2015-09-27 10:08:51"
4716 } 4768 }
4717 ], 4769 ],
4718 "aliases": [], 4770 "aliases": [],
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 6f6269a4..7bec5b5e 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -20,6 +20,11 @@
20 20
21 <php> 21 <php>
22 <server name="KERNEL_DIR" value="./app/" /> 22 <server name="KERNEL_DIR" value="./app/" />
23 <!--
24 Avoid tests to fail because of deprecated stuff
25 see: http://symfony.com/doc/current/cookbook/upgrade/major_version.html#deprecations-in-phpunit
26 -->
27 <env name="SYMFONY_DEPRECATIONS_HELPER" value="weak" />
23 </php> 28 </php>
24 29
25 <filter> 30 <filter>
diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
index 1fee56ad..74bfe4dc 100644
--- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
+++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php
@@ -40,7 +40,7 @@ class WallabagRestController extends FOSRestController
40 40
41 private function validateAuthentication() 41 private function validateAuthentication()
42 { 42 {
43 if (false === $this->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) { 43 if (false === $this->get('security.authorization_checker')->isGranted('IS_AUTHENTICATED_FULLY')) {
44 throw new AccessDeniedException(); 44 throw new AccessDeniedException();
45 } 45 }
46 } 46 }
@@ -347,7 +347,7 @@ class WallabagRestController extends FOSRestController
347 */ 347 */
348 private function validateUserAccess($requestUserId) 348 private function validateUserAccess($requestUserId)
349 { 349 {
350 $user = $this->get('security.context')->getToken()->getUser(); 350 $user = $this->get('security.token_storage')->getToken()->getUser();
351 if ($requestUserId != $user->getId()) { 351 if ($requestUserId != $user->getId()) {
352 throw $this->createAccessDeniedException('Access forbidden. Entry user id: '.$requestUserId.', logged user id: '.$user->getId()); 352 throw $this->createAccessDeniedException('Access forbidden. Entry user id: '.$requestUserId.', logged user id: '.$user->getId());
353 } 353 }
diff --git a/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php b/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php
index 119889b3..09cde0f6 100644
--- a/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php
+++ b/src/Wallabag/ApiBundle/Tests/AbstractControllerTest.php
@@ -25,7 +25,6 @@ abstract class AbstractControllerTest extends WebTestCase
25 $client = static::createClient(); 25 $client = static::createClient();
26 $container = $client->getContainer(); 26 $container = $client->getContainer();
27 27
28 $session = $container->get('session');
29 /** @var $userManager \FOS\UserBundle\Doctrine\UserManager */ 28 /** @var $userManager \FOS\UserBundle\Doctrine\UserManager */
30 $userManager = $container->get('fos_user.user_manager'); 29 $userManager = $container->get('fos_user.user_manager');
31 /** @var $loginManager \FOS\UserBundle\Security\LoginManager */ 30 /** @var $loginManager \FOS\UserBundle\Security\LoginManager */
@@ -36,9 +35,10 @@ abstract class AbstractControllerTest extends WebTestCase
36 $loginManager->loginUser($firewallName, $user); 35 $loginManager->loginUser($firewallName, $user);
37 36
38 // save the login token into the session and put it in a cookie 37 // save the login token into the session and put it in a cookie
39 $container->get('session')->set('_security_'.$firewallName, 38 $container->get('session')->set('_security_'.$firewallName, serialize($container->get('security.token_storage')->getToken()));
40 serialize($container->get('security.context')->getToken()));
41 $container->get('session')->save(); 39 $container->get('session')->save();
40
41 $session = $container->get('session');
42 $client->getCookieJar()->set(new Cookie($session->getName(), $session->getId())); 42 $client->getCookieJar()->set(new Cookie($session->getName(), $session->getId()));
43 43
44 return $client; 44 return $client;
diff --git a/src/Wallabag/CoreBundle/Command/InstallCommand.php b/src/Wallabag/CoreBundle/Command/InstallCommand.php
index 6ebbd93c..808baaf6 100644
--- a/src/Wallabag/CoreBundle/Command/InstallCommand.php
+++ b/src/Wallabag/CoreBundle/Command/InstallCommand.php
@@ -8,6 +8,9 @@ use Symfony\Component\Console\Input\InputOption;
8use Symfony\Component\Console\Input\ArrayInput; 8use Symfony\Component\Console\Input\ArrayInput;
9use Symfony\Component\Console\Output\OutputInterface; 9use Symfony\Component\Console\Output\OutputInterface;
10use Symfony\Component\Console\Output\NullOutput; 10use Symfony\Component\Console\Output\NullOutput;
11use Symfony\Component\Console\Question\Question;
12use Symfony\Component\Console\Question\ConfirmationQuestion;
13use Symfony\Component\Console\Helper\Table;
11use Wallabag\UserBundle\Entity\User; 14use Wallabag\UserBundle\Entity\User;
12use Wallabag\CoreBundle\Entity\Config; 15use Wallabag\CoreBundle\Entity\Config;
13 16
@@ -85,10 +88,11 @@ class InstallCommand extends ContainerAwareCommand
85 } 88 }
86 $rows[] = array($label, $status, $help); 89 $rows[] = array($label, $status, $help);
87 90
88 $this->getHelper('table') 91 $table = new Table($this->defaultOutput);
92 $table
89 ->setHeaders(array('Checked', 'Status', 'Recommendation')) 93 ->setHeaders(array('Checked', 'Status', 'Recommendation'))
90 ->setRows($rows) 94 ->setRows($rows)
91 ->render($this->defaultOutput); 95 ->render();
92 96
93 if (!$fulfilled) { 97 if (!$fulfilled) {
94 throw new \RuntimeException('Some system requirements are not fulfilled. Please check output messages and fix them.'); 98 throw new \RuntimeException('Some system requirements are not fulfilled. Please check output messages and fix them.');
@@ -130,9 +134,10 @@ class InstallCommand extends ContainerAwareCommand
130 return $this; 134 return $this;
131 } 135 }
132 136
133 $dialog = $this->getHelper('dialog'); 137 $questionHelper = $this->getHelper('question');
138 $question = new ConfirmationQuestion('It appears that your database already exists. Would you like to reset it? (y/N)', false);
134 139
135 if ($dialog->askConfirmation($this->defaultOutput, '<question>It appears that your database already exists. Would you like to reset it? (y/N)</question> ', false)) { 140 if ($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)) {
136 $this->defaultOutput->writeln('Droping database, creating database and schema'); 141 $this->defaultOutput->writeln('Droping database, creating database and schema');
137 142
138 $this 143 $this
@@ -141,7 +146,8 @@ class InstallCommand extends ContainerAwareCommand
141 ->runCommand('doctrine:schema:create') 146 ->runCommand('doctrine:schema:create')
142 ; 147 ;
143 } elseif ($this->isSchemaPresent()) { 148 } elseif ($this->isSchemaPresent()) {
144 if ($dialog->askConfirmation($this->defaultOutput, '<question>Seems like your database contains schema. Do you want to reset it? (y/N)</question> ', false)) { 149 $question = new ConfirmationQuestion('Seems like your database contains schema. Do you want to reset it? (y/N)', false);
150 if ($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)) {
145 $this->defaultOutput->writeln('Droping schema and creating schema'); 151 $this->defaultOutput->writeln('Droping schema and creating schema');
146 152
147 $this 153 $this
@@ -160,17 +166,6 @@ class InstallCommand extends ContainerAwareCommand
160 $this->defaultOutput->writeln('Clearing the cache'); 166 $this->defaultOutput->writeln('Clearing the cache');
161 $this->runCommand('cache:clear'); 167 $this->runCommand('cache:clear');
162 168
163 /*
164 if ($this->getHelperSet()->get('dialog')->askConfirmation($this->defaultOutput, '<question>Load fixtures (Y/N)?</question>', false)) {
165 $doctrineConfig = $this->getContainer()->get('doctrine.orm.entity_manager')->getConnection()->getConfiguration();
166 $logger = $doctrineConfig->getSQLLogger();
167 // speed up fixture load
168 $doctrineConfig->setSQLLogger(null);
169 $this->runCommand('doctrine:fixtures:load');
170 $doctrineConfig->setSQLLogger($logger);
171 }
172 */
173
174 $this->defaultOutput->writeln(''); 169 $this->defaultOutput->writeln('');
175 170
176 return $this; 171 return $this;
@@ -180,9 +175,10 @@ class InstallCommand extends ContainerAwareCommand
180 { 175 {
181 $this->defaultOutput->writeln('<info><comment>Step 3 of 4.</comment> Administration setup.</info>'); 176 $this->defaultOutput->writeln('<info><comment>Step 3 of 4.</comment> Administration setup.</info>');
182 177
183 $dialog = $this->getHelperSet()->get('dialog'); 178 $questionHelper = $this->getHelperSet()->get('question');
179 $question = new ConfirmationQuestion('Would you like to create a new user ? (y/N)', false);
184 180
185 if (false === $dialog->askConfirmation($this->defaultOutput, '<question>Would you like to create a new user ? (y/N)</question>', true)) { 181 if (!$questionHelper->ask($this->defaultInput, $this->defaultOutput, $question)) {
186 return $this; 182 return $this;
187 } 183 }
188 184
@@ -190,9 +186,16 @@ class InstallCommand extends ContainerAwareCommand
190 186
191 $userManager = $this->getContainer()->get('fos_user.user_manager'); 187 $userManager = $this->getContainer()->get('fos_user.user_manager');
192 $user = $userManager->createUser(); 188 $user = $userManager->createUser();
193 $user->setUsername($dialog->ask($this->defaultOutput, '<question>Username</question> <comment>(default: wallabag)</comment> :', 'wallabag')); 189
194 $user->setPlainPassword($dialog->ask($this->defaultOutput, '<question>Password</question> <comment>(default: wallabag)</comment> :', 'wallabag')); 190 $question = new Question('Username (default: wallabag) :', 'wallabag');
195 $user->setEmail($dialog->ask($this->defaultOutput, '<question>Email:</question>', '')); 191 $user->setUsername($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question));
192
193 $question = new Question('Password (default: wallabag) :', 'wallabag');
194 $user->setPlainPassword($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question));
195
196 $question = new Question('Email:', '');
197 $user->setEmail($questionHelper->ask($this->defaultInput, $this->defaultOutput, $question));
198
196 $user->setEnabled(true); 199 $user->setEnabled(true);
197 200
198 $em->persist($user); 201 $em->persist($user);
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php
index ca4acc6a..8bbe4ca0 100644
--- a/src/Wallabag/CoreBundle/Controller/ConfigController.php
+++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php
@@ -29,7 +29,7 @@ class ConfigController extends Controller
29 $user = $this->getUser(); 29 $user = $this->getUser();
30 30
31 // handle basic config detail (this form is defined as a service) 31 // handle basic config detail (this form is defined as a service)
32 $configForm = $this->createForm('config', $config); 32 $configForm = $this->createForm('config', $config, array('action' => $this->generateUrl('config')));
33 $configForm->handleRequest($request); 33 $configForm->handleRequest($request);
34 34
35 if ($configForm->isValid()) { 35 if ($configForm->isValid()) {
@@ -49,7 +49,7 @@ class ConfigController extends Controller
49 } 49 }
50 50
51 // handle changing password 51 // handle changing password
52 $pwdForm = $this->createForm(new ChangePasswordType()); 52 $pwdForm = $this->createForm(new ChangePasswordType(), null, array('action' => $this->generateUrl('config').'#set4'));
53 $pwdForm->handleRequest($request); 53 $pwdForm->handleRequest($request);
54 54
55 if ($pwdForm->isValid()) { 55 if ($pwdForm->isValid()) {
@@ -65,7 +65,10 @@ class ConfigController extends Controller
65 } 65 }
66 66
67 // handle changing user information 67 // handle changing user information
68 $userForm = $this->createForm(new UserInformationType(), $user, array('validation_groups' => array('Profile'))); 68 $userForm = $this->createForm(new UserInformationType(), $user, array(
69 'validation_groups' => array('Profile'),
70 'action' => $this->generateUrl('config').'#set3',
71 ));
69 $userForm->handleRequest($request); 72 $userForm->handleRequest($request);
70 73
71 if ($userForm->isValid()) { 74 if ($userForm->isValid()) {
@@ -80,7 +83,7 @@ class ConfigController extends Controller
80 } 83 }
81 84
82 // handle rss information 85 // handle rss information
83 $rssForm = $this->createForm(new RssType(), $config); 86 $rssForm = $this->createForm(new RssType(), $config, array('action' => $this->generateUrl('config').'#set2'));
84 $rssForm->handleRequest($request); 87 $rssForm->handleRequest($request);
85 88
86 if ($rssForm->isValid()) { 89 if ($rssForm->isValid()) {
@@ -99,7 +102,10 @@ class ConfigController extends Controller
99 $newUser = $userManager->createUser(); 102 $newUser = $userManager->createUser();
100 // enable created user by default 103 // enable created user by default
101 $newUser->setEnabled(true); 104 $newUser->setEnabled(true);
102 $newUserForm = $this->createForm(new NewUserType(), $newUser, array('validation_groups' => array('Profile'))); 105 $newUserForm = $this->createForm(new NewUserType(), $newUser, array(
106 'validation_groups' => array('Profile'),
107 'action' => $this->generateUrl('config').'#set5',
108 ));
103 $newUserForm->handleRequest($request); 109 $newUserForm->handleRequest($request);
104 110
105 if ($newUserForm->isValid() && $this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) { 111 if ($newUserForm->isValid() && $this->get('security.authorization_checker')->isGranted('ROLE_SUPER_ADMIN')) {
diff --git a/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php b/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php
index 054a3752..23e98042 100644
--- a/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php
+++ b/src/Wallabag/CoreBundle/Helper/DetectActiveTheme.php
@@ -3,7 +3,7 @@
3namespace Wallabag\CoreBundle\Helper; 3namespace Wallabag\CoreBundle\Helper;
4 4
5use Liip\ThemeBundle\Helper\DeviceDetectionInterface; 5use Liip\ThemeBundle\Helper\DeviceDetectionInterface;
6use Symfony\Component\Security\Core\SecurityContextInterface; 6use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorageInterface;
7use Wallabag\UserBundle\Entity\User; 7use Wallabag\UserBundle\Entity\User;
8 8
9/** 9/**
@@ -14,16 +14,16 @@ use Wallabag\UserBundle\Entity\User;
14 */ 14 */
15class DetectActiveTheme implements DeviceDetectionInterface 15class DetectActiveTheme implements DeviceDetectionInterface
16{ 16{
17 protected $securityContext; 17 protected $tokenStorage;
18 protected $defaultTheme; 18 protected $defaultTheme;
19 19
20 /** 20 /**
21 * @param SecurityContextInterface $securityContext Needed to retrieve the current user 21 * @param TokenStorageInterface $tokenStorage Needed to retrieve the current user
22 * @param string $defaultTheme Default theme when user isn't logged in 22 * @param string $defaultTheme Default theme when user isn't logged in
23 */ 23 */
24 public function __construct(SecurityContextInterface $securityContext, $defaultTheme) 24 public function __construct(TokenStorageInterface $tokenStorage, $defaultTheme)
25 { 25 {
26 $this->securityContext = $securityContext; 26 $this->tokenStorage = $tokenStorage;
27 $this->defaultTheme = $defaultTheme; 27 $this->defaultTheme = $defaultTheme;
28 } 28 }
29 29
@@ -42,7 +42,7 @@ class DetectActiveTheme implements DeviceDetectionInterface
42 */ 42 */
43 public function getType() 43 public function getType()
44 { 44 {
45 $token = $this->securityContext->getToken(); 45 $token = $this->tokenStorage->getToken();
46 46
47 if (is_null($token)) { 47 if (is_null($token)) {
48 return $this->defaultTheme; 48 return $this->defaultTheme;
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml
index 3c479ff6..debbf39e 100644
--- a/src/Wallabag/CoreBundle/Resources/config/services.yml
+++ b/src/Wallabag/CoreBundle/Resources/config/services.yml
@@ -2,7 +2,7 @@ services:
2 wallabag_core.helper.detect_active_theme: 2 wallabag_core.helper.detect_active_theme:
3 class: Wallabag\CoreBundle\Helper\DetectActiveTheme 3 class: Wallabag\CoreBundle\Helper\DetectActiveTheme
4 arguments: 4 arguments:
5 - @security.context 5 - @security.token_storage
6 - %theme% # default theme from parameters.yml 6 - %theme% # default theme from parameters.yml
7 7
8 # custom form type 8 # custom form type
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig
index abe5dc9e..7a7d6af1 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/baggy/Config/index.html.twig
@@ -5,7 +5,7 @@
5{% block content %} 5{% block content %}
6 <h2>{% trans %}Wallabag configuration{% endtrans %}</h2> 6 <h2>{% trans %}Wallabag configuration{% endtrans %}</h2>
7 7
8 <form action="{{ path('config') }}" method="post" {{ form_enctype(form.config) }}> 8 {{ form_start(form.config) }}
9 {{ form_errors(form.config) }} 9 {{ form_errors(form.config) }}
10 10
11 <fieldset class="w500p inline"> 11 <fieldset class="w500p inline">
@@ -37,7 +37,7 @@
37 37
38 <h2>{% trans %}RSS configuration{% endtrans %}</h2> 38 <h2>{% trans %}RSS configuration{% endtrans %}</h2>
39 39
40 <form action="{{ path('config') }}" method="post" {{ form_enctype(form.rss) }}> 40 {{ form_start(form.rss) }}
41 {{ form_errors(form.rss) }} 41 {{ form_errors(form.rss) }}
42 42
43 <fieldset class="w500p inline"> 43 <fieldset class="w500p inline">
@@ -81,7 +81,7 @@
81 81
82 <h2>{% trans %}User information{% endtrans %}</h2> 82 <h2>{% trans %}User information{% endtrans %}</h2>
83 83
84 <form action="{{ path('config') }}" method="post" {{ form_enctype(form.user) }}> 84 {{ form_start(form.user) }}
85 {{ form_errors(form.user) }} 85 {{ form_errors(form.user) }}
86 86
87 <fieldset class="w500p inline"> 87 <fieldset class="w500p inline">
@@ -115,7 +115,7 @@
115 115
116 <h2>{% trans %}Change your password{% endtrans %}</h2> 116 <h2>{% trans %}Change your password{% endtrans %}</h2>
117 117
118 <form action="{{ path('config') }}" method="post" {{ form_enctype(form.pwd) }}> 118 {{ form_start(form.pwd) }}
119 {{ form_errors(form.pwd) }} 119 {{ form_errors(form.pwd) }}
120 120
121 <fieldset class="w500p inline"> 121 <fieldset class="w500p inline">
@@ -148,7 +148,7 @@
148 {% if is_granted('ROLE_SUPER_ADMIN') %} 148 {% if is_granted('ROLE_SUPER_ADMIN') %}
149 <h2>{% trans %}Add a user{% endtrans %}</h2> 149 <h2>{% trans %}Add a user{% endtrans %}</h2>
150 150
151 <form action="{{ path('config') }}" method="post" {{ form_enctype(form.new_user) }}> 151 {{ form_start(form.new_user) }}
152 {{ form_errors(form.new_user) }} 152 {{ form_errors(form.new_user) }}
153 153
154 <fieldset class="w500p inline"> 154 <fieldset class="w500p inline">
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
index ab24d4ef..8f121a2b 100644
--- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
+++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Config/index.html.twig
@@ -21,9 +21,8 @@
21 </ul> 21 </ul>
22 </div> 22 </div>
23 23
24
25 <div id="set1" class="col s12"> 24 <div id="set1" class="col s12">
26 <form action="{{ path('config') }}" method="post" {{ form_enctype(form.config) }}> 25 {{ form_start(form.config) }}
27 {{ form_errors(form.config) }} 26 {{ form_errors(form.config) }}
28 27
29 <div class="row"> 28 <div class="row">
@@ -57,9 +56,8 @@
57 </form> 56 </form>
58 </div> 57 </div>
59 58
60
61 <div id="set2" class="col s12"> 59 <div id="set2" class="col s12">
62 <form action="{{ path('config') }}#set2" method="post" {{ form_enctype(form.rss) }}> 60 {{ form_start(form.rss) }}
63 {{ form_errors(form.rss) }} 61 {{ form_errors(form.rss) }}
64 62
65 <div class="row"> 63 <div class="row">
@@ -111,9 +109,8 @@
111 </form> 109 </form>
112 </div> 110 </div>
113 111
114
115 <div id="set3" class="col s12"> 112 <div id="set3" class="col s12">
116 <form action="{{ path('config') }}#set3" method="post" {{ form_enctype(form.user) }}> 113 {{ form_start(form.user) }}
117 {{ form_errors(form.user) }} 114 {{ form_errors(form.user) }}
118 115
119 <div class="row"> 116 <div class="row">
@@ -150,9 +147,8 @@
150 </form> 147 </form>
151 </div> 148 </div>
152 149
153
154 <div id="set4" class="col s12"> 150 <div id="set4" class="col s12">
155 <form action="{{ path('config') }}#set4" method="post" {{ form_enctype(form.pwd) }}> 151 {{ form_start(form.pwd) }}
156 {{ form_errors(form.pwd) }} 152 {{ form_errors(form.pwd) }}
157 153
158 <div class="row"> 154 <div class="row">
@@ -189,7 +185,7 @@
189 185
190 {% if is_granted('ROLE_SUPER_ADMIN') %} 186 {% if is_granted('ROLE_SUPER_ADMIN') %}
191 <div id="set5" class="col s12"> 187 <div id="set5" class="col s12">
192 <form action="{{ path('config') }}#set5" method="post" {{ form_enctype(form.new_user) }}> 188 {{ form_start(form.new_user) }}
193 {{ form_errors(form.new_user) }} 189 {{ form_errors(form.new_user) }}
194 190
195 <div class="row"> 191 <div class="row">
diff --git a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
index 24910e60..e98dd202 100644
--- a/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
+++ b/src/Wallabag/CoreBundle/Tests/Command/InstallCommandTest.php
@@ -35,19 +35,16 @@ class InstallCommandTest extends WallabagCoreTestCase
35 35
36 $command = $application->find('wallabag:install'); 36 $command = $application->find('wallabag:install');
37 37
38 // We mock the DialogHelper 38 // We mock the QuestionHelper
39 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') 39 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
40 ->disableOriginalConstructor() 40 ->disableOriginalConstructor()
41 ->getMock(); 41 ->getMock();
42 $dialog->expects($this->any()) 42 $question->expects($this->any())
43 ->method('ask') 43 ->method('ask')
44 ->will($this->returnValue('test_'.uniqid('', true))); 44 ->will($this->returnValue('yes_'.uniqid('', true)));
45 $dialog->expects($this->any())
46 ->method('askConfirmation')
47 ->will($this->returnValue(true));
48 45
49 // We override the standard helper with our mock 46 // We override the standard helper with our mock
50 $command->getHelperSet()->set($dialog, 'dialog'); 47 $command->getHelperSet()->set($question, 'question');
51 48
52 $tester = new CommandTester($command); 49 $tester = new CommandTester($command);
53 $tester->execute(array( 50 $tester->execute(array(
@@ -69,19 +66,16 @@ class InstallCommandTest extends WallabagCoreTestCase
69 66
70 $command = $application->find('wallabag:install'); 67 $command = $application->find('wallabag:install');
71 68
72 // We mock the DialogHelper 69 // We mock the QuestionHelper
73 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') 70 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
74 ->disableOriginalConstructor() 71 ->disableOriginalConstructor()
75 ->getMock(); 72 ->getMock();
76 $dialog->expects($this->any()) 73 $question->expects($this->any())
77 ->method('ask') 74 ->method('ask')
78 ->will($this->returnValue('test_'.uniqid('', true))); 75 ->will($this->returnValue('yes_'.uniqid('', true)));
79 $dialog->expects($this->any())
80 ->method('askConfirmation')
81 ->will($this->returnValue(true));
82 76
83 // We override the standard helper with our mock 77 // We override the standard helper with our mock
84 $command->getHelperSet()->set($dialog, 'dialog'); 78 $command->getHelperSet()->set($question, 'question');
85 79
86 $tester = new CommandTester($command); 80 $tester = new CommandTester($command);
87 $tester->execute(array( 81 $tester->execute(array(
@@ -119,19 +113,16 @@ class InstallCommandTest extends WallabagCoreTestCase
119 113
120 $command = $application->find('wallabag:install'); 114 $command = $application->find('wallabag:install');
121 115
122 // We mock the DialogHelper 116 // We mock the QuestionHelper
123 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') 117 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
124 ->disableOriginalConstructor() 118 ->disableOriginalConstructor()
125 ->getMock(); 119 ->getMock();
126 $dialog->expects($this->any()) 120 $question->expects($this->any())
127 ->method('ask') 121 ->method('ask')
128 ->will($this->returnValue('test_'.uniqid('', true))); 122 ->will($this->returnValue('yes_'.uniqid('', true)));
129 $dialog->expects($this->any())
130 ->method('askConfirmation')
131 ->will($this->returnValue(true));
132 123
133 // We override the standard helper with our mock 124 // We override the standard helper with our mock
134 $command->getHelperSet()->set($dialog, 'dialog'); 125 $command->getHelperSet()->set($question, 'question');
135 126
136 $tester = new CommandTester($command); 127 $tester = new CommandTester($command);
137 $tester->execute(array( 128 $tester->execute(array(
@@ -156,13 +147,13 @@ class InstallCommandTest extends WallabagCoreTestCase
156 147
157 $command = $application->find('wallabag:install'); 148 $command = $application->find('wallabag:install');
158 149
159 // We mock the DialogHelper 150 // We mock the QuestionHelper
160 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') 151 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
161 ->disableOriginalConstructor() 152 ->disableOriginalConstructor()
162 ->getMock(); 153 ->getMock();
163 154
164 $dialog->expects($this->exactly(3)) 155 $question->expects($this->exactly(3))
165 ->method('askConfirmation') 156 ->method('ask')
166 ->will($this->onConsecutiveCalls( 157 ->will($this->onConsecutiveCalls(
167 false, // don't want to reset the entire database 158 false, // don't want to reset the entire database
168 true, // do want to reset the schema 159 true, // do want to reset the schema
@@ -170,7 +161,7 @@ class InstallCommandTest extends WallabagCoreTestCase
170 )); 161 ));
171 162
172 // We override the standard helper with our mock 163 // We override the standard helper with our mock
173 $command->getHelperSet()->set($dialog, 'dialog'); 164 $command->getHelperSet()->set($question, 'question');
174 165
175 $tester = new CommandTester($command); 166 $tester = new CommandTester($command);
176 $tester->execute(array( 167 $tester->execute(array(
@@ -216,20 +207,20 @@ class InstallCommandTest extends WallabagCoreTestCase
216 207
217 $command = $application->find('wallabag:install'); 208 $command = $application->find('wallabag:install');
218 209
219 // We mock the DialogHelper 210 // We mock the QuestionHelper
220 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') 211 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
221 ->disableOriginalConstructor() 212 ->disableOriginalConstructor()
222 ->getMock(); 213 ->getMock();
223 214
224 $dialog->expects($this->exactly(2)) 215 $question->expects($this->exactly(2))
225 ->method('askConfirmation') 216 ->method('ask')
226 ->will($this->onConsecutiveCalls( 217 ->will($this->onConsecutiveCalls(
227 false, // don't want to reset the entire database 218 false, // don't want to reset the entire database
228 false // don't want to create a new user 219 false // don't want to create a new user
229 )); 220 ));
230 221
231 // We override the standard helper with our mock 222 // We override the standard helper with our mock
232 $command->getHelperSet()->set($dialog, 'dialog'); 223 $command->getHelperSet()->set($question, 'question');
233 224
234 $tester = new CommandTester($command); 225 $tester = new CommandTester($command);
235 $tester->execute(array( 226 $tester->execute(array(
@@ -253,19 +244,16 @@ class InstallCommandTest extends WallabagCoreTestCase
253 244
254 $command = $application->find('wallabag:install'); 245 $command = $application->find('wallabag:install');
255 246
256 // We mock the DialogHelper 247 // We mock the QuestionHelper
257 $dialog = $this->getMockBuilder('Symfony\Component\Console\Helper\DialogHelper') 248 $question = $this->getMockBuilder('Symfony\Component\Console\Helper\QuestionHelper')
258 ->disableOriginalConstructor() 249 ->disableOriginalConstructor()
259 ->getMock(); 250 ->getMock();
260 $dialog->expects($this->any()) 251 $question->expects($this->any())
261 ->method('ask') 252 ->method('ask')
262 ->will($this->returnValue('test_'.uniqid('', true))); 253 ->will($this->returnValue('yes_'.uniqid('', true)));
263 $dialog->expects($this->any())
264 ->method('askConfirmation')
265 ->will($this->returnValue(true));
266 254
267 // We override the standard helper with our mock 255 // We override the standard helper with our mock
268 $command->getHelperSet()->set($dialog, 'dialog'); 256 $command->getHelperSet()->set($question, 'question');
269 257
270 $tester = new CommandTester($command); 258 $tester = new CommandTester($command);
271 $tester->execute(array( 259 $tester->execute(array(