2020-04-04 08:16:05 +08:00
|
|
|
<?php namespace Tests\Entity;
|
2017-11-17 02:02:36 +08:00
|
|
|
|
2020-04-04 08:16:05 +08:00
|
|
|
use BookStack\Entities\Page;
|
|
|
|
use Tests\BrowserKitTest;
|
2017-11-17 02:02:36 +08:00
|
|
|
|
2020-04-04 08:16:05 +08:00
|
|
|
class CommentSettingTest extends BrowserKitTest
|
|
|
|
{
|
|
|
|
protected $page;
|
2017-11-17 02:02:36 +08:00
|
|
|
|
2020-04-04 08:16:05 +08:00
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
parent::setUp();
|
|
|
|
$this->page = Page::first();
|
|
|
|
}
|
2017-11-17 02:02:36 +08:00
|
|
|
|
2020-04-04 08:16:05 +08:00
|
|
|
public function test_comment_disable()
|
|
|
|
{
|
|
|
|
$this->asAdmin();
|
2017-11-17 02:02:36 +08:00
|
|
|
|
2020-04-04 08:16:05 +08:00
|
|
|
$this->setSettings(['app-disable-comments' => 'true']);
|
2017-11-17 02:02:36 +08:00
|
|
|
|
2020-04-04 08:16:05 +08:00
|
|
|
$this->asAdmin()->visit($this->page->getUrl())
|
|
|
|
->pageNotHasElement('.comments-list');
|
|
|
|
}
|
2017-11-17 02:02:36 +08:00
|
|
|
|
2020-04-04 08:16:05 +08:00
|
|
|
public function test_comment_enable()
|
|
|
|
{
|
|
|
|
$this->asAdmin();
|
2017-11-17 02:02:36 +08:00
|
|
|
|
2020-04-04 08:16:05 +08:00
|
|
|
$this->setSettings(['app-disable-comments' => 'false']);
|
|
|
|
|
|
|
|
$this->asAdmin()->visit($this->page->getUrl())
|
|
|
|
->pageHasElement('.comments-list');
|
|
|
|
}
|
2017-11-17 02:02:36 +08:00
|
|
|
}
|