mirror of
https://github.com/wallabag/wallabag.git
synced 2025-07-02 16:38:38 +00:00
Move and rename Guzzle\AuthenticatorSubscriber to HttpClient\Authenticator
This commit is contained in:
parent
991c074d6e
commit
335054c9a3
3 changed files with 13 additions and 13 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\Event\BeforeEvent;
|
use GuzzleHttp\Event\BeforeEvent;
|
||||||
use GuzzleHttp\Event\CompleteEvent;
|
use GuzzleHttp\Event\CompleteEvent;
|
||||||
|
@ -13,7 +13,7 @@ use Wallabag\SiteConfig\LoginFormAuthenticator;
|
||||||
use Wallabag\SiteConfig\SiteConfig;
|
use Wallabag\SiteConfig\SiteConfig;
|
||||||
use Wallabag\SiteConfig\SiteConfigBuilder;
|
use Wallabag\SiteConfig\SiteConfigBuilder;
|
||||||
|
|
||||||
class AuthenticatorSubscriber implements SubscriberInterface, LoggerAwareInterface
|
class Authenticator implements SubscriberInterface, LoggerAwareInterface
|
||||||
{
|
{
|
||||||
// avoid loop when login failed which can just be a bad login/password
|
// avoid loop when login failed which can just be a bad login/password
|
||||||
// after 2 attempts, we skip the login
|
// after 2 attempts, we skip the login
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
namespace Tests\Wallabag\Guzzle;
|
namespace Tests\Wallabag\HttpClient;
|
||||||
|
|
||||||
use GuzzleHttp\Client;
|
use GuzzleHttp\Client;
|
||||||
use GuzzleHttp\Event\BeforeEvent;
|
use GuzzleHttp\Event\BeforeEvent;
|
||||||
|
@ -12,11 +12,11 @@ use GuzzleHttp\Subscriber\Mock;
|
||||||
use Monolog\Handler\TestHandler;
|
use Monolog\Handler\TestHandler;
|
||||||
use Monolog\Logger;
|
use Monolog\Logger;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
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 testGetEvents()
|
public function testGetEvents()
|
||||||
{
|
{
|
||||||
|
@ -24,7 +24,7 @@ class AuthenticatorSubscriberTest extends TestCase
|
||||||
->disableOriginalConstructor()
|
->disableOriginalConstructor()
|
||||||
->getMock();
|
->getMock();
|
||||||
|
|
||||||
$subscriber = new AuthenticatorSubscriber(
|
$subscriber = new Authenticator(
|
||||||
new ArraySiteConfigBuilder(),
|
new ArraySiteConfigBuilder(),
|
||||||
$authenticator
|
$authenticator
|
||||||
);
|
);
|
||||||
|
@ -43,7 +43,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();
|
||||||
|
@ -83,7 +83,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();
|
||||||
|
@ -128,7 +128,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();
|
||||||
|
@ -168,7 +168,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();
|
||||||
|
@ -220,7 +220,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();
|
||||||
|
@ -271,7 +271,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…
Add table
Add a link
Reference in a new issue