X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=tests%2FWallabag%2FCoreBundle%2FGuzzleSiteAuthenticator%2FGrabySiteConfigBuilderTest.php;h=1173fc3dee8f4a858ceaba71658a7281aa243ab3;hb=739a4024fa64ba5412078e01c8ae84628f865f26;hp=980f75793b9cb1efa6d229f459225bfd951f6935;hpb=b8427f22f06cab58383ec3080f09715c712c65ef;p=github%2Fwallabag%2Fwallabag.git diff --git a/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php b/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php index 980f7579..1173fc3d 100644 --- a/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php +++ b/tests/Wallabag/CoreBundle/GuzzleSiteAuthenticator/GrabySiteConfigBuilderTest.php @@ -2,16 +2,15 @@ namespace Tests\Wallabag\CoreBundle\GuzzleSiteAuthenticator; +use Graby\SiteConfig\SiteConfig as GrabySiteConfig; use Monolog\Handler\TestHandler; use Monolog\Logger; -use BD\GuzzleSiteAuthenticator\SiteConfig\SiteConfig; -use Graby\SiteConfig\SiteConfig as GrabySiteConfig; -use PHPUnit_Framework_TestCase; -use Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder; -use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use PHPUnit\Framework\TestCase; use Symfony\Component\Security\Core\Authentication\Token\Storage\TokenStorage; +use Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken; +use Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder; -class GrabySiteConfigBuilderTest extends PHPUnit_Framework_TestCase +class GrabySiteConfigBuilderTest extends TestCase { /** @var \Wallabag\CoreBundle\GuzzleSiteAuthenticator\GrabySiteConfigBuilder */ protected $builder; @@ -25,7 +24,7 @@ class GrabySiteConfigBuilderTest extends PHPUnit_Framework_TestCase $grabySiteConfig = new GrabySiteConfig(); $grabySiteConfig->requires_login = true; - $grabySiteConfig->login_uri = 'http://example.com/login'; + $grabySiteConfig->login_uri = 'http://www.example.com/login'; $grabySiteConfig->login_username_field = 'login'; $grabySiteConfig->login_password_field = 'password'; $grabySiteConfig->login_extra_fields = ['field=value']; @@ -67,22 +66,17 @@ class GrabySiteConfigBuilderTest extends PHPUnit_Framework_TestCase $logger ); - $config = $this->builder->buildForHost('example.com'); - - $this->assertEquals( - new SiteConfig([ - 'host' => 'example.com', - 'requiresLogin' => true, - 'loginUri' => 'http://example.com/login', - 'usernameField' => 'login', - 'passwordField' => 'password', - 'extraFields' => ['field' => 'value'], - 'notLoggedInXpath' => '//div[@class="need-login"]', - 'username' => 'foo', - 'password' => 'bar', - ]), - $config - ); + $config = $this->builder->buildForHost('www.example.com'); + + $this->assertSame('example.com', $config->getHost()); + $this->assertTrue($config->requiresLogin()); + $this->assertSame('http://www.example.com/login', $config->getLoginUri()); + $this->assertSame('login', $config->getUsernameField()); + $this->assertSame('password', $config->getPasswordField()); + $this->assertSame(['field' => 'value'], $config->getExtraFields()); + $this->assertSame('//div[@class="need-login"]', $config->getNotLoggedInXpath()); + $this->assertSame('foo', $config->getUsername()); + $this->assertSame('bar', $config->getPassword()); $records = $handler->getRecords();