blob: 2f277e66dc10fd56cd79156a16ab72e647dbcad7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
<?php
/**
* Tests for Rpost module.
*
* SPDX-FileCopyrightText: 2024 Hubzilla Community
* SPDX-FileContributor: Harald Eilertsen
*
* SPDX-License-Identifier: MIT
*/
class RpostTest extends \Zotlabs\Tests\Unit\Module\TestCase {
/**
* Basic test of a get request with no args as an authenticated user.
*/
public function test_get_with_no_args(): void {
// Mock `local_chanel()` to emulate a valid logged in channel
$lc_mock = $this->getFunctionMock('Zotlabs\Module', 'local_channel')
->expects($this->any())
->willReturn(42);
// Set basic access controls to keep AccessList happy.
\App::$channel = [
'channel_allow_cid' => null,
'channel_allow_gid' => null,
'channel_deny_cid' => null,
'channel_deny_gid' => null,
];
$this->get('rpost');
$this->assertPageContains('<form id="profile-jot-form"');
$this->assertPageContains('<input type="hidden" name="profile_uid" value="42"');
}
/**
* Display login form if session is not authenticated.
*/
public function test_display_login_form_if_not_logged_in(): void {
$lc_mock = $this->getFunctionMock('Zotlabs\Module', 'local_channel')
->expects($this->any())
->willReturn(false);
$this->get('rpost');
$this->assertPageContains('<form action="https://hubzilla.test/rpost" id="main_login"');
}
}
|