Remove voter & add tests

This commit is contained in:
Jeremy Benoist
2025-10-02 11:54:12 +02:00
parent 7e7674a4a6
commit 5629330cb6
29 changed files with 269 additions and 154 deletions

View File

@ -11,7 +11,7 @@ use Wallabag\Entity\Entry;
class WallabagV1ControllerTest extends WallabagTestCase
{
public function testImportWallabag()
public function testImportWallabagV1()
{
$this->logInAs('admin');
$client = $this->getTestClient();
@ -23,7 +23,7 @@ class WallabagV1ControllerTest extends WallabagTestCase
$this->assertSame(1, $crawler->filter('input[type=file]')->count());
}
public function testImportWallabagWithRabbitEnabled()
public function testImportWallabagV1WithRabbitEnabled()
{
$this->logInAs('admin');
$client = $this->getTestClient();
@ -39,7 +39,7 @@ class WallabagV1ControllerTest extends WallabagTestCase
$client->getContainer()->get(Config::class)->set('import_with_rabbitmq', 0);
}
public function testImportWallabagBadFile()
public function testImportWallabagV1BadFile()
{
$this->logInAs('admin');
$client = $this->getTestClient();
@ -56,7 +56,7 @@ class WallabagV1ControllerTest extends WallabagTestCase
$this->assertSame(200, $client->getResponse()->getStatusCode());
}
public function testImportWallabagWithRedisEnabled()
public function testImportWallabagV1WithRedisEnabled()
{
$this->checkRedis();
$this->logInAs('admin');
@ -92,7 +92,7 @@ class WallabagV1ControllerTest extends WallabagTestCase
$client->getContainer()->get(Config::class)->set('import_with_redis', 0);
}
public function testImportWallabagWithFile()
public function testImportWallabagV1WithFile()
{
$this->logInAs('admin');
$client = $this->getTestClient();
@ -136,7 +136,7 @@ class WallabagV1ControllerTest extends WallabagTestCase
$this->assertInstanceOf(\DateTime::class, $content->getCreatedAt());
}
public function testImportWallabagWithFileAndMarkAllAsRead()
public function testImportWallabagV1WithFileAndMarkAllAsRead()
{
$this->logInAs('admin');
$client = $this->getTestClient();
@ -183,7 +183,7 @@ class WallabagV1ControllerTest extends WallabagTestCase
$this->assertStringContainsString('flashes.import.notice.summary', $body[0]);
}
public function testImportWallabagWithEmptyFile()
public function testImportWallabagV1WithEmptyFile()
{
$this->logInAs('admin');
$client = $this->getTestClient();
@ -206,4 +206,17 @@ class WallabagV1ControllerTest extends WallabagTestCase
$this->assertGreaterThan(1, $body = $crawler->filter('body')->extract(['_text']));
$this->assertStringContainsString('flashes.import.notice.failed', $body[0]);
}
public function testImportWallabagV1Disabled()
{
$this->logInAs('admin');
$client = $this->getTestClient();
$client->getContainer()->get(Config::class)->set('wallabag_v1_enabled', 0);
$client->request('GET', '/import/wallabag_v1');
$this->assertSame(404, $client->getResponse()->getStatusCode());
$client->getContainer()->get(Config::class)->set('wallabag_v1_enabled', 1);
}
}