MDL-64820 forum: fix cibot complaints

This commit is contained in:
Ryan Wyllie 2019-03-22 10:38:41 +08:00
parent f30f46db39
commit 446ba04650
5 changed files with 15 additions and 6 deletions

View file

@ -28,7 +28,6 @@ defined('MOODLE_INTERNAL') || die();
use mod_forum\local\entities\discussion as discussion_entity;
use mod_forum\local\entities\forum as forum_entity;
use mod_forum\local\entities\forum;
use mod_forum\local\entities\post as post_entity;
use mod_forum\local\factories\legacy_data_mapper as legacy_data_mapper_factory;
use mod_forum\local\factories\exporter as exporter_factory;
@ -38,6 +37,8 @@ use renderer_base;
use stdClass;
/**
* Exported discussion summaries builder class.
*
* This class is an implementation of the builder pattern (loosely). It is responsible
* for taking a set of related forums, discussions, and posts and generate the exported
* version of the discussion summaries.
@ -48,6 +49,10 @@ use stdClass;
*
* See this doc for more information on the builder pattern:
* https://designpatternsphp.readthedocs.io/en/latest/Creational/Builder/README.html
*
* @package mod_forum
* @copyright 2019 Mihail Geshoski <mihail@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class exported_discussion_summaries {
/** @var renderer_base $renderer Core renderer */
@ -100,7 +105,7 @@ class exported_discussion_summaries {
*/
public function build(
stdClass $user,
forum $forum,
forum_entity $forum,
array $discussions
) : array {

View file

@ -416,7 +416,7 @@ class renderer {
$exportedpostsbuilder = $this->builderfactory->get_exported_posts_builder();
$discussionentries = [];
$postentries = [];
foreach($discussions as $discussion) {
foreach ($discussions as $discussion) {
$discussionentries[] = $discussion->get_discussion();
$discussionentriesids[] = $discussion->get_discussion()->get_id();
$postentries[] = $discussion->get_first_post();

View file

@ -93,6 +93,7 @@ class discussion_list {
* @param capability_manager $capabilitymanager The managed used to check capabilities on the forum
* @param url_factory $urlfactory The factory used to create URLs in the forum
* @param notification[] $notifications A list of any notifications to be displayed within the page
* @param callable|null $postprocessfortemplate Callback function to process discussion lists for templates
*/
public function __construct(
forum_entity $forum,

View file

@ -47,7 +47,10 @@ class mod_forum_local_container_testcase extends advanced_testcase {
* @covers ::get_legacy_data_mapper_factory
*/
public function test_get_legacy_data_mapper_factory() {
$this->assertInstanceOf(\mod_forum\local\factories\legacy_data_mapper::class, \mod_forum\local\container::get_legacy_data_mapper_factory());
$this->assertInstanceOf(
\mod_forum\local\factories\legacy_data_mapper::class,
\mod_forum\local\container::get_legacy_data_mapper_factory()
);
}
/**