[terms] add tests

This commit is contained in:
Shish 2024-06-07 14:48:34 +01:00 committed by Shish
parent 2f07d4c71c
commit 978d0d629b

27
ext/terms/test.php Normal file
View file

@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace Shimmie2;
class TermsTest extends ShimmiePHPUnitTestCase
{
public function testFresh(): void
{
$this->request('GET', 'post/list', cookies: []);
$this->assert_text("terms-modal-enter");
}
public function testLoggedIn(): void
{
$this->log_in_as_user();
$this->request('GET', 'post/list', cookies: []);
$this->assert_no_text("terms-modal-enter");
}
public function testCookie(): void
{
$this->request('GET', 'post/list', cookies: ['shm_accepted_terms' => 'true']);
$this->assert_no_text("terms-modal-enter");
}
}