get_authenticated(); $this->assertPageContains('
assertPageContains('getFunctionMock('Zotlabs\Module', 'local_channel') ->expects($this->any()) ->willReturn(false); $this->get('rpost'); $this->assertPageContains('get_authenticated([ 'title' => 'This is my title', 'body' => 'The body of the post', 'source' => 'The temple of the Dagon', ]); $this->assertPageContains('value="This is my title"'); $this->assertPageContains('>The body of the post'); $this->assertPageContains('value="The temple of the Dagon"'); } public function test_convert_body_from_html_to_bbcode(): void { $this->get_authenticated([ 'body' => "

Awesome page

\r\n

Awesome content!

", 'type' => 'html', ]); $this->assertPageContains(">[h1]Awesome page[/h1]\n\nAwesome content!"); } /** * Private helper method to perform an authenticated GET request. * * @param array $query An associative array of query parameters. */ private function get_authenticated(array $query = []): 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_id' => 42, 'channel_location' => null, 'channel_address' => '', 'channel_allow_cid' => '', 'channel_allow_gid' => '', 'channel_deny_cid' => '', 'channel_deny_gid' => '', ]; $this->get('rpost', $query); } }