mirror of
https://github.com/wallabag/wallabag.git
synced 2025-04-26 19:54:44 +00:00
Migrate from Guzzle to Symfony HttpClient - 3
This commit is contained in:
parent
784b54cd98
commit
f42d530491
3 changed files with 12 additions and 15 deletions
|
@ -220,7 +220,7 @@ services:
|
||||||
|
|
||||||
Wallabag\Helper\HttpClientFactory:
|
Wallabag\Helper\HttpClientFactory:
|
||||||
calls:
|
calls:
|
||||||
- ['addSubscriber', ['@Wallabag\Guzzle\AuthenticatorSubscriber']]
|
- ['addSubscriber', ['@Wallabag\HttpClient\Authenticator']]
|
||||||
|
|
||||||
RulerZ\RulerZ:
|
RulerZ\RulerZ:
|
||||||
alias: rulerz
|
alias: rulerz
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Wallabag\Guzzle;
|
namespace Wallabag\HttpClient;
|
||||||
|
|
||||||
use GuzzleHttp\Psr7\Uri;
|
use GuzzleHttp\Psr7\Uri;
|
||||||
use Psr\Http\Message\UriInterface;
|
use Psr\Http\Message\UriInterface;
|
||||||
|
@ -12,7 +12,7 @@ use Wallabag\SiteConfig\LoginFormAuthenticator;
|
||||||
use Wallabag\SiteConfig\SiteConfig;
|
use Wallabag\SiteConfig\SiteConfig;
|
||||||
use Wallabag\SiteConfig\SiteConfigBuilder;
|
use Wallabag\SiteConfig\SiteConfigBuilder;
|
||||||
|
|
||||||
class AuthenticatorSubscriber implements LoggerAwareInterface
|
class Authenticator implements LoggerAwareInterface
|
||||||
{
|
{
|
||||||
/** @var SiteConfigBuilder */
|
/** @var SiteConfigBuilder */
|
||||||
private $configBuilder;
|
private $configBuilder;
|
||||||
|
@ -23,9 +23,6 @@ class AuthenticatorSubscriber implements LoggerAwareInterface
|
||||||
/** @var LoggerInterface */
|
/** @var LoggerInterface */
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
/**
|
|
||||||
* AuthenticatorSubscriber constructor.
|
|
||||||
*/
|
|
||||||
public function __construct(SiteConfigBuilder $configBuilder, LoginFormAuthenticator $authenticator)
|
public function __construct(SiteConfigBuilder $configBuilder, LoginFormAuthenticator $authenticator)
|
||||||
{
|
{
|
||||||
$this->configBuilder = $configBuilder;
|
$this->configBuilder = $configBuilder;
|
|
@ -1,16 +1,16 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Tests\Wallabag\Guzzle;
|
namespace Tests\Wallabag\HttpClient;
|
||||||
|
|
||||||
use Monolog\Handler\TestHandler;
|
use Monolog\Handler\TestHandler;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
use Symfony\Contracts\HttpClient\ResponseInterface;
|
use Symfony\Contracts\HttpClient\ResponseInterface;
|
||||||
use Wallabag\Guzzle\AuthenticatorSubscriber;
|
use Wallabag\HttpClient\Authenticator;
|
||||||
use Wallabag\SiteConfig\ArraySiteConfigBuilder;
|
use Wallabag\SiteConfig\ArraySiteConfigBuilder;
|
||||||
use Wallabag\SiteConfig\LoginFormAuthenticator;
|
use Wallabag\SiteConfig\LoginFormAuthenticator;
|
||||||
|
|
||||||
class AuthenticatorSubscriberTest extends TestCase
|
class AuthenticatorTest extends TestCase
|
||||||
{
|
{
|
||||||
public function testLoginIfRequiredNotRequired()
|
public function testLoginIfRequiredNotRequired()
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@ class AuthenticatorSubscriberTest extends TestCase
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$builder = new ArraySiteConfigBuilder(['example.com' => []]);
|
$builder = new ArraySiteConfigBuilder(['example.com' => []]);
|
||||||
$subscriber = new AuthenticatorSubscriber($builder, $authenticator);
|
$subscriber = new \Wallabag\HttpClient\Authenticator($builder, $authenticator);
|
||||||
|
|
||||||
$logger = new Logger('foo');
|
$logger = new Logger('foo');
|
||||||
$handler = new TestHandler();
|
$handler = new TestHandler();
|
||||||
|
@ -51,7 +51,7 @@ class AuthenticatorSubscriberTest extends TestCase
|
||||||
->method('login');
|
->method('login');
|
||||||
|
|
||||||
$builder = new ArraySiteConfigBuilder(['example.com' => ['requiresLogin' => true]]);
|
$builder = new ArraySiteConfigBuilder(['example.com' => ['requiresLogin' => true]]);
|
||||||
$subscriber = new AuthenticatorSubscriber($builder, $authenticator);
|
$subscriber = new Authenticator($builder, $authenticator);
|
||||||
|
|
||||||
$logger = new Logger('foo');
|
$logger = new Logger('foo');
|
||||||
$handler = new TestHandler();
|
$handler = new TestHandler();
|
||||||
|
@ -76,7 +76,7 @@ class AuthenticatorSubscriberTest extends TestCase
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$builder = new ArraySiteConfigBuilder(['example.com' => []]);
|
$builder = new ArraySiteConfigBuilder(['example.com' => []]);
|
||||||
$subscriber = new AuthenticatorSubscriber($builder, $authenticator);
|
$subscriber = new Authenticator($builder, $authenticator);
|
||||||
|
|
||||||
$logger = new Logger('foo');
|
$logger = new Logger('foo');
|
||||||
$handler = new TestHandler();
|
$handler = new TestHandler();
|
||||||
|
@ -117,7 +117,7 @@ class AuthenticatorSubscriberTest extends TestCase
|
||||||
'requiresLogin' => true,
|
'requiresLogin' => true,
|
||||||
'notLoggedInXpath' => '//html',
|
'notLoggedInXpath' => '//html',
|
||||||
]]);
|
]]);
|
||||||
$subscriber = new AuthenticatorSubscriber($builder, $authenticator);
|
$subscriber = new Authenticator($builder, $authenticator);
|
||||||
|
|
||||||
$logger = new Logger('foo');
|
$logger = new Logger('foo');
|
||||||
$handler = new TestHandler();
|
$handler = new TestHandler();
|
||||||
|
@ -165,7 +165,7 @@ class AuthenticatorSubscriberTest extends TestCase
|
||||||
'requiresLogin' => true,
|
'requiresLogin' => true,
|
||||||
'notLoggedInXpath' => '//html',
|
'notLoggedInXpath' => '//html',
|
||||||
]]);
|
]]);
|
||||||
$subscriber = new AuthenticatorSubscriber($builder, $authenticator);
|
$subscriber = new Authenticator($builder, $authenticator);
|
||||||
|
|
||||||
$logger = new Logger('foo');
|
$logger = new Logger('foo');
|
||||||
$handler = new TestHandler();
|
$handler = new TestHandler();
|
||||||
|
@ -206,7 +206,7 @@ class AuthenticatorSubscriberTest extends TestCase
|
||||||
'requiresLogin' => true,
|
'requiresLogin' => true,
|
||||||
'notLoggedInXpath' => '//html',
|
'notLoggedInXpath' => '//html',
|
||||||
]]);
|
]]);
|
||||||
$subscriber = new AuthenticatorSubscriber($builder, $authenticator);
|
$subscriber = new Authenticator($builder, $authenticator);
|
||||||
|
|
||||||
$logger = new Logger('foo');
|
$logger = new Logger('foo');
|
||||||
$handler = new TestHandler();
|
$handler = new TestHandler();
|
Loading…
Reference in a new issue