Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Differences Between: [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18   * Tests for the local\container class.
  19   *
  20   * @package    mod_forum
  21   * @copyright  2019 Andrew Nicols <andrew@nicols.co.uk>
  22   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  23   */
  24  
  25  defined('MOODLE_INTERNAL') || die();
  26  
  27  /**
  28   * Tests for the local\container class.
  29   *
  30   * @copyright  2019 Andrew Nicols <andrew@nicols.co.uk>
  31   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  32   * @coversDefaultClass \mod_forum\local\container
  33   */
  34  class mod_forum_local_container_testcase extends advanced_testcase {
  35      /**
  36       * Ensure that a renderer factory is returned.
  37       *
  38       * @covers ::get_renderer_factory
  39       */
  40      public function test_get_renderer_factory() {
  41          $this->assertInstanceOf(\mod_forum\local\factories\renderer::class, \mod_forum\local\container::get_renderer_factory());
  42      }
  43  
  44      /**
  45       * Ensure that a legacy_data_mapper_factory factory is returned.
  46       *
  47       * @covers ::get_legacy_data_mapper_factory
  48       */
  49      public function test_get_legacy_data_mapper_factory() {
  50          $this->assertInstanceOf(
  51              \mod_forum\local\factories\legacy_data_mapper::class,
  52              \mod_forum\local\container::get_legacy_data_mapper_factory()
  53          );
  54      }
  55  
  56      /**
  57       * Ensure that a exporter factory is returned.
  58       *
  59       * @covers ::get_exporter_factory
  60       */
  61      public function test_get_exporter_factory() {
  62          $this->assertInstanceOf(\mod_forum\local\factories\exporter::class, \mod_forum\local\container::get_exporter_factory());
  63      }
  64  
  65      /**
  66       * Ensure that a vault factory is returned.
  67       *
  68       * @covers ::get_vault_factory
  69       */
  70      public function test_get_vault_factory() {
  71          $this->assertInstanceOf(\mod_forum\local\factories\vault::class, \mod_forum\local\container::get_vault_factory());
  72      }
  73  
  74      /**
  75       * Ensure that a manager factory is returned.
  76       *
  77       * @covers ::get_manager_factory
  78       */
  79      public function test_get_manager_factory() {
  80          $this->assertInstanceOf(\mod_forum\local\factories\manager::class, \mod_forum\local\container::get_manager_factory());
  81      }
  82  
  83      /**
  84       * Ensure that a entity factory is returned.
  85       *
  86       * @covers ::get_entity_factory
  87       */
  88      public function test_get_entity_factory() {
  89          $this->assertInstanceOf(\mod_forum\local\factories\entity::class, \mod_forum\local\container::get_entity_factory());
  90      }
  91  
  92      /**
  93       * Ensure that a builder factory is returned.
  94       *
  95       * @covers ::get_builder_factory
  96       */
  97      public function test_get_builder_factory() {
  98          $this->assertInstanceOf(\mod_forum\local\factories\builder::class, \mod_forum\local\container::get_builder_factory());
  99      }
 100  
 101      /**
 102       * Ensure that a url factory is returned.
 103       *
 104       * @covers ::get_url_factory
 105       */
 106      public function test_get_url_factory() {
 107          $this->assertInstanceOf(\mod_forum\local\factories\url::class, \mod_forum\local\container::get_url_factory());
 108      }
 109  }