Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 39 and 402]

The post exporter tests.

Copyright: 2019 Ryan Wyllie <ryan@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 596 lines (23 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 1 file
 mod/forum/tests/generator_trait.php

Defines 2 classes


Class: exporters_post_test  - X-Ref

The post exporter tests.

test_export_post($istimed = false, $addtime = 0)   X-Ref
Test the export function returns expected values.

param: bool $istimed True if this is a timed post
param: int $addtime Seconds to be added to the current time

export_post_provider()   X-Ref
Data provider for test_export_post().

return: array

test_export_deleted_post()   X-Ref
Test exporting of a deleted post.


test_export_post_no_view_capability()   X-Ref
Test exporting of a post the user can't view.


Class: test_capability_manager  - X-Ref

Test implementation of the capability manager.

__construct(bool $view = true,bool $edit = true,bool $delete = true,bool $split = true,bool $reply = true,bool $export = true,bool $controlreadstatus = true,bool $canreplyprivatelytopost = true,bool $canenrol = true)   X-Ref
Constructor.

param: bool $view Value for can_view_post
param: bool $edit Value for can_edit_post
param: bool $delete Value for can_delete_post
param: bool $split Value for can_split_post
param: bool $reply Value for can_reply_to_post
param: bool $export Value for can_export_post
param: bool $controlreadstatus Value for can_manually_control_post_read_status

can_view_post(\stdClass $user, discussion_entity $discussion, post_entity $post)   X-Ref
Override can_view_post

param: \stdClass $user The user
param: discussion_entity $discussion The discussion
param: post_entity $post The post
return: bool

can_edit_post(\stdClass $user, discussion_entity $discussion, post_entity $post)   X-Ref
Override can_edit_post

param: \stdClass $user The user
param: discussion_entity $discussion The discussion
param: post_entity $post The post
return: bool

can_delete_post(\stdClass $user, discussion_entity $discussion, post_entity $post,bool $hasreplies = false)   X-Ref
Override can_delete_post

param: \stdClass $user The user
param: discussion_entity $discussion The discussion
param: post_entity $post The post
param: bool $hasreplies
return: bool

can_split_post(\stdClass $user, discussion_entity $discussion, post_entity $post)   X-Ref
Override can_split_post

param: \stdClass $user The user
param: discussion_entity $discussion The discussion
param: post_entity $post The post
return: bool

can_reply_to_post(\stdClass $user, discussion_entity $discussion, post_entity $post)   X-Ref
Override can_reply_to_post

param: \stdClass $user The user
param: discussion_entity $discussion The discussion
param: post_entity $post The post
return: bool

can_export_post(\stdClass $user, post_entity $post)   X-Ref
Override can_export_post

param: \stdClass $user The user
param: post_entity $post The post
return: bool

can_manually_control_post_read_status(\stdClass $user)   X-Ref
Override can_manually_control_post_read_status

param: \stdClass $user The user
return: bool

can_reply_privately_to_post(\stdClass $user, post_entity $post)   X-Ref
Override can_reply_privately_to_post

param: \stdClass $user
param: post_entity $post
return: bool

can_self_enrol(\stdClass $user)   X-Ref
Override can_self_enrol

param: \stdClass $user
return: bool