2021-06-26 17:23:15 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests\Entity;
|
2017-11-16 19:02:36 +01:00
|
|
|
|
2020-11-22 01:17:45 +01:00
|
|
|
use BookStack\Entities\Models\Page;
|
2021-05-30 00:42:21 +02:00
|
|
|
use Tests\TestCase;
|
2017-11-16 19:02:36 +01:00
|
|
|
|
2021-05-30 00:42:21 +02:00
|
|
|
class CommentSettingTest extends TestCase
|
2020-04-04 02:16:05 +02:00
|
|
|
{
|
|
|
|
protected $page;
|
2017-11-16 19:02:36 +01:00
|
|
|
|
2021-10-30 22:29:59 +02:00
|
|
|
protected function setUp(): void
|
2020-04-04 02:16:05 +02:00
|
|
|
{
|
|
|
|
parent::setUp();
|
2021-05-30 00:42:21 +02:00
|
|
|
$this->page = Page::query()->first();
|
2020-04-04 02:16:05 +02:00
|
|
|
}
|
2017-11-16 19:02:36 +01:00
|
|
|
|
2020-04-04 02:16:05 +02:00
|
|
|
public function test_comment_disable()
|
|
|
|
{
|
|
|
|
$this->setSettings(['app-disable-comments' => 'true']);
|
2021-05-30 00:42:21 +02:00
|
|
|
$this->asAdmin();
|
2017-11-16 19:02:36 +01:00
|
|
|
|
2021-05-30 00:42:21 +02:00
|
|
|
$this->asAdmin()->get($this->page->getUrl())
|
|
|
|
->assertElementNotExists('.comments-list');
|
2020-04-04 02:16:05 +02:00
|
|
|
}
|
2017-11-16 19:02:36 +01:00
|
|
|
|
2020-04-04 02:16:05 +02:00
|
|
|
public function test_comment_enable()
|
|
|
|
{
|
|
|
|
$this->setSettings(['app-disable-comments' => 'false']);
|
2021-05-30 00:42:21 +02:00
|
|
|
$this->asAdmin();
|
2020-04-04 02:16:05 +02:00
|
|
|
|
2021-05-30 00:42:21 +02:00
|
|
|
$this->asAdmin()->get($this->page->getUrl())
|
|
|
|
->assertElementExists('.comments-list');
|
2020-04-04 02:16:05 +02:00
|
|
|
}
|
2021-06-26 17:23:15 +02:00
|
|
|
}
|