1
0
Fork 0
mirror of https://github.com/wallabag/wallabag.git synced 2025-10-05 19:31:02 +00:00

Remove voter & add tests

This commit is contained in:
Jeremy Benoist 2025-10-02 11:54:12 +02:00
parent 7e7674a4a6
commit 5629330cb6
No known key found for this signature in database
GPG key ID: 7168D5DD29F38552
29 changed files with 269 additions and 154 deletions

View file

@ -75,6 +75,11 @@ class PocketControllerTest extends WallabagTestCase
->method('getRequestToken')
->willReturn('token');
$pocketImport
->expects($this->once())
->method('isEnabled')
->willReturn(true);
static::$kernel->getContainer()->set(PocketImport::class, $pocketImport);
$client->request('POST', '/import/pocket/auth');
@ -97,6 +102,11 @@ class PocketControllerTest extends WallabagTestCase
->method('authorize')
->willReturn(false);
$pocketImport
->expects($this->once())
->method('isEnabled')
->willReturn(true);
static::$kernel->getContainer()->set(PocketImport::class, $pocketImport);
$client->request('GET', '/import/pocket/callback');
@ -131,6 +141,11 @@ class PocketControllerTest extends WallabagTestCase
->method('import')
->willReturn(true);
$pocketImport
->expects($this->once())
->method('isEnabled')
->willReturn(true);
static::$kernel->getContainer()->set(PocketImport::class, $pocketImport);
$client->request('GET', '/import/pocket/callback');
@ -139,4 +154,17 @@ class PocketControllerTest extends WallabagTestCase
$this->assertStringContainsString('/', $client->getResponse()->headers->get('location'), 'Import is ok, redirect to homepage');
$this->assertSame('flashes.import.notice.summary', $client->getContainer()->get(SessionInterface::class)->getFlashBag()->peek('notice')[0]);
}
public function testImportPocketDisabled()
{
$this->logInAs('admin');
$client = $this->getTestClient();
$client->getContainer()->get(Config::class)->set('pocket_enabled', 0);
$client->request('GET', '/import/pocket');
$this->assertSame(404, $client->getResponse()->getStatusCode());
$client->getContainer()->get(Config::class)->set('pocket_enabled', 1);
}
}