diff --git a/src/Wallabag/CoreBundle/Entity/Config.php b/src/Wallabag/CoreBundle/Entity/Config.php index 750d4ced0..081d25027 100644 --- a/src/Wallabag/CoreBundle/Entity/Config.php +++ b/src/Wallabag/CoreBundle/Entity/Config.php @@ -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"}) */ diff --git a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php index 44de9dd26..03a7485df 100644 --- a/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php +++ b/tests/Wallabag/CoreBundle/Controller/ConfigControllerTest.php @@ -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'); + } }