Added test

This commit is contained in:
Nicolas Lœuillet 2023-06-14 14:50:17 +02:00 committed by Simounet
parent 19322142c3
commit 7eddea6ff7
No known key found for this signature in database
GPG key ID: 77D3B7DC794EB770
2 changed files with 37 additions and 1 deletions

View file

@ -120,7 +120,7 @@ class Config
/**
* @var int
*
* @ORM\Column(name="display_thumbnails", type="integer", nullable=true)
* @ORM\Column(name="display_thumbnails", type="integer", nullable=true, options={"default" = 1})
*
* @Groups({"config_api"})
*/

View file

@ -1354,4 +1354,40 @@ class ConfigControllerTest extends WallabagCoreTestCase
$this->assertCount(5, $taggingRules);
$this->assertSame('title matches "football"', $taggingRules[4]->getRule());
}
public function testSwitchDisplayThumbnails()
{
$this->logInAs('admin');
$client = $this->getTestClient();
// Change configuration to show thumbnails
$crawler = $client->request('GET', '/config');
$this->assertSame(200, $client->getResponse()->getStatusCode());
$form = $crawler->filter('button[id=config_save]')->form();
$data = [
'config[display_thumbnails]' => true,
];
$client->submit($form, $data);
$client->followRedirect();
$client->request('GET', '/unread/list');
$this->assertStringContainsString('class="preview"', $client->getResponse()->getContent());
// Change configuration to hide thumbnails
$crawler = $client->request('GET', '/config');
$this->assertSame(200, $client->getResponse()->getStatusCode());
$form = $crawler->filter('button[id=config_save]')->form();
$data = [
'config[display_thumbnails]' => false,
];
$client->submit($form, $data);
$client->followRedirect();
$client->request('GET', '/unread/list');
$this->assertStringNotContainsString('class="preview"', $client->getResponse()->getContent());
$client->request('GET', '/config/view-mode');
}
}