diff options
author | Nicolas LÅ“uillet <nicolas@loeuillet.org> | 2016-10-31 09:39:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-31 09:39:53 +0100 |
commit | 7d9abd1ab5425626ce3b0b241f2f50879e109375 (patch) | |
tree | 9553a49a380cbc827dfff5308129aaac99ad7fa1 | |
parent | f74061f1e1e70f8f1ec1fb72f7cf6e1ed388023c (diff) | |
parent | e1632cea0e19475ff0cc642ea05b365ce651912b (diff) | |
download | wallabag-7d9abd1ab5425626ce3b0b241f2f50879e109375.tar.gz wallabag-7d9abd1ab5425626ce3b0b241f2f50879e109375.tar.zst wallabag-7d9abd1ab5425626ce3b0b241f2f50879e109375.zip |
Merge pull request #2520 from wallabag/config
Inject parameter instead of service
6 files changed, 13 insertions, 22 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index e50c68a6..4bf292a4 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php | |||
@@ -8,7 +8,6 @@ use JMS\Serializer\SerializerBuilder; | |||
8 | use PHPePub\Core\EPub; | 8 | use PHPePub\Core\EPub; |
9 | use PHPePub\Core\Structure\OPF\DublinCore; | 9 | use PHPePub\Core\Structure\OPF\DublinCore; |
10 | use Symfony\Component\HttpFoundation\Response; | 10 | use Symfony\Component\HttpFoundation\Response; |
11 | use Craue\ConfigBundle\Util\Config; | ||
12 | 11 | ||
13 | /** | 12 | /** |
14 | * This class doesn't have unit test BUT it's fully covered by a functional test with ExportControllerTest. | 13 | * This class doesn't have unit test BUT it's fully covered by a functional test with ExportControllerTest. |
@@ -27,12 +26,12 @@ class EntriesExport | |||
27 | </div>'; | 26 | </div>'; |
28 | 27 | ||
29 | /** | 28 | /** |
30 | * @param Config $craueConfig CraueConfig instance to get wallabag instance url from database | 29 | * @param string $wallabagUrl Wallabag instance url |
31 | * @param string $logoPath Path to the logo FROM THE BUNDLE SCOPE | 30 | * @param string $logoPath Path to the logo FROM THE BUNDLE SCOPE |
32 | */ | 31 | */ |
33 | public function __construct(Config $craueConfig, $logoPath) | 32 | public function __construct($wallabagUrl, $logoPath) |
34 | { | 33 | { |
35 | $this->wallabagUrl = $craueConfig->get('wallabag_url'); | 34 | $this->wallabagUrl = $wallabagUrl; |
36 | $this->logoPath = $logoPath; | 35 | $this->logoPath = $logoPath; |
37 | } | 36 | } |
38 | 37 | ||
diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 614488a6..b7b1b61b 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml | |||
@@ -91,7 +91,7 @@ services: | |||
91 | wallabag_core.helper.entries_export: | 91 | wallabag_core.helper.entries_export: |
92 | class: Wallabag\CoreBundle\Helper\EntriesExport | 92 | class: Wallabag\CoreBundle\Helper\EntriesExport |
93 | arguments: | 93 | arguments: |
94 | - "@craue_config" | 94 | - '@=service(''craue_config'').get(''wallabag_url'')' |
95 | - src/Wallabag/CoreBundle/Resources/public/themes/_global/img/appicon/apple-touch-icon-152.png | 95 | - src/Wallabag/CoreBundle/Resources/public/themes/_global/img/appicon/apple-touch-icon-152.png |
96 | 96 | ||
97 | wallabag.operator.array.matches: | 97 | wallabag.operator.array.matches: |
diff --git a/src/Wallabag/ImportBundle/Resources/config/services.yml b/src/Wallabag/ImportBundle/Resources/config/services.yml index 89adc71b..d600be0f 100644 --- a/src/Wallabag/ImportBundle/Resources/config/services.yml +++ b/src/Wallabag/ImportBundle/Resources/config/services.yml | |||
@@ -20,7 +20,6 @@ services: | |||
20 | arguments: | 20 | arguments: |
21 | - "@doctrine.orm.entity_manager" | 21 | - "@doctrine.orm.entity_manager" |
22 | - "@wallabag_core.content_proxy" | 22 | - "@wallabag_core.content_proxy" |
23 | - "@craue_config" | ||
24 | calls: | 23 | calls: |
25 | - [ setClient, [ "@wallabag_import.pocket.client" ] ] | 24 | - [ setClient, [ "@wallabag_import.pocket.client" ] ] |
26 | - [ setLogger, [ "@logger" ]] | 25 | - [ setLogger, [ "@logger" ]] |
diff --git a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php index ca9d18f1..961208f2 100644 --- a/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php +++ b/src/Wallabag/UserBundle/Mailer/AuthCodeMailer.php | |||
@@ -4,7 +4,6 @@ namespace Wallabag\UserBundle\Mailer; | |||
4 | 4 | ||
5 | use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; | 5 | use Scheb\TwoFactorBundle\Model\Email\TwoFactorInterface; |
6 | use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface; | 6 | use Scheb\TwoFactorBundle\Mailer\AuthCodeMailerInterface; |
7 | use Craue\ConfigBundle\Util\Config; | ||
8 | 7 | ||
9 | /** | 8 | /** |
10 | * Custom mailer for TwoFactorBundle email. | 9 | * Custom mailer for TwoFactorBundle email. |
@@ -61,16 +60,17 @@ class AuthCodeMailer implements AuthCodeMailerInterface | |||
61 | * @param \Twig_Environment $twig | 60 | * @param \Twig_Environment $twig |
62 | * @param string $senderEmail | 61 | * @param string $senderEmail |
63 | * @param string $senderName | 62 | * @param string $senderName |
64 | * @param Config $craueConfig Craue\Config instance to get wallabag support url from database | 63 | * @param string $supportUrl wallabag support url |
64 | * @param string $wallabagUrl wallabag instance url | ||
65 | */ | 65 | */ |
66 | public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, Config $craueConfig) | 66 | public function __construct(\Swift_Mailer $mailer, \Twig_Environment $twig, $senderEmail, $senderName, $supportUrl, $wallabagUrl) |
67 | { | 67 | { |
68 | $this->mailer = $mailer; | 68 | $this->mailer = $mailer; |
69 | $this->twig = $twig; | 69 | $this->twig = $twig; |
70 | $this->senderEmail = $senderEmail; | 70 | $this->senderEmail = $senderEmail; |
71 | $this->senderName = $senderName; | 71 | $this->senderName = $senderName; |
72 | $this->supportUrl = $craueConfig->get('wallabag_support_url'); | 72 | $this->supportUrl = $supportUrl; |
73 | $this->wallabagUrl = $craueConfig->get('wallabag_url'); | 73 | $this->wallabagUrl = $wallabagUrl; |
74 | } | 74 | } |
75 | 75 | ||
76 | /** | 76 | /** |
diff --git a/src/Wallabag/UserBundle/Resources/config/services.yml b/src/Wallabag/UserBundle/Resources/config/services.yml index eb9c8e67..a8ee721b 100644 --- a/src/Wallabag/UserBundle/Resources/config/services.yml +++ b/src/Wallabag/UserBundle/Resources/config/services.yml | |||
@@ -6,7 +6,8 @@ services: | |||
6 | - "@twig" | 6 | - "@twig" |
7 | - "%scheb_two_factor.email.sender_email%" | 7 | - "%scheb_two_factor.email.sender_email%" |
8 | - "%scheb_two_factor.email.sender_name%" | 8 | - "%scheb_two_factor.email.sender_name%" |
9 | - "@craue_config" | 9 | - '@=service(''craue_config'').get(''wallabag_support_url'')' |
10 | - '@=service(''craue_config'').get(''wallabag_url'')' | ||
10 | 11 | ||
11 | wallabag_user.password_resetting: | 12 | wallabag_user.password_resetting: |
12 | class: Wallabag\UserBundle\EventListener\PasswordResettingListener | 13 | class: Wallabag\UserBundle\EventListener\PasswordResettingListener |
diff --git a/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php b/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php index 441d6519..21412da6 100644 --- a/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php +++ b/tests/Wallabag/UserBundle/Mailer/AuthCodeMailerTest.php | |||
@@ -26,7 +26,6 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase | |||
26 | protected $mailer; | 26 | protected $mailer; |
27 | protected $spool; | 27 | protected $spool; |
28 | protected $twig; | 28 | protected $twig; |
29 | protected $config; | ||
30 | 29 | ||
31 | protected function setUp() | 30 | protected function setUp() |
32 | { | 31 | { |
@@ -44,14 +43,6 @@ class AuthCodeMailerTest extends \PHPUnit_Framework_TestCase | |||
44 | TWIG; | 43 | TWIG; |
45 | 44 | ||
46 | $this->twig = new \Twig_Environment(new \Twig_Loader_Array(['WallabagUserBundle:TwoFactor:email_auth_code.html.twig' => $twigTemplate])); | 45 | $this->twig = new \Twig_Environment(new \Twig_Loader_Array(['WallabagUserBundle:TwoFactor:email_auth_code.html.twig' => $twigTemplate])); |
47 | |||
48 | $this->config = $this->getMockBuilder('Craue\ConfigBundle\Util\Config') | ||
49 | ->disableOriginalConstructor() | ||
50 | ->getMock(); | ||
51 | |||
52 | $this->config->expects($this->any()) | ||
53 | ->method('get') | ||
54 | ->willReturn('http://0.0.0.0/support'); | ||
55 | } | 46 | } |
56 | 47 | ||
57 | public function testSendEmail() | 48 | public function testSendEmail() |
@@ -67,7 +58,8 @@ TWIG; | |||
67 | $this->twig, | 58 | $this->twig, |
68 | 'nobody@test.io', | 59 | 'nobody@test.io', |
69 | 'wallabag test', | 60 | 'wallabag test', |
70 | $this->config | 61 | 'http://0.0.0.0/support', |
62 | 'http://0.0.0.0/' | ||
71 | ); | 63 | ); |
72 | 64 | ||
73 | $authCodeMailer->sendAuthCode($user); | 65 | $authCodeMailer->sendAuthCode($user); |