Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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

   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  namespace mod_forum;
  18  
  19  /**
  20   * Tests for the local\container class.
  21   *
  22   * @package    mod_forum
  23   * @copyright  2019 Andrew Nicols <andrew@nicols.co.uk>
  24   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  25   * @coversDefaultClass \mod_forum\local\container
  26   */
  27  class local_container_test extends \advanced_testcase {
  28      /**
  29       * Ensure that a renderer factory is returned.
  30       *
  31       * @covers ::get_renderer_factory
  32       */
  33      public function test_get_renderer_factory() {
  34          $this->assertInstanceOf(\mod_forum\local\factories\renderer::class, \mod_forum\local\container::get_renderer_factory());
  35      }
  36  
  37      /**
  38       * Ensure that a legacy_data_mapper_factory factory is returned.
  39       *
  40       * @covers ::get_legacy_data_mapper_factory
  41       */
  42      public function test_get_legacy_data_mapper_factory() {
  43          $this->assertInstanceOf(
  44              \mod_forum\local\factories\legacy_data_mapper::class,
  45              \mod_forum\local\container::get_legacy_data_mapper_factory()
  46          );
  47      }
  48  
  49      /**
  50       * Ensure that a exporter factory is returned.
  51       *
  52       * @covers ::get_exporter_factory
  53       */
  54      public function test_get_exporter_factory() {
  55          $this->assertInstanceOf(\mod_forum\local\factories\exporter::class, \mod_forum\local\container::get_exporter_factory());
  56      }
  57  
  58      /**
  59       * Ensure that a vault factory is returned.
  60       *
  61       * @covers ::get_vault_factory
  62       */
  63      public function test_get_vault_factory() {
  64          $this->assertInstanceOf(\mod_forum\local\factories\vault::class, \mod_forum\local\container::get_vault_factory());
  65      }
  66  
  67      /**
  68       * Ensure that a manager factory is returned.
  69       *
  70       * @covers ::get_manager_factory
  71       */
  72      public function test_get_manager_factory() {
  73          $this->assertInstanceOf(\mod_forum\local\factories\manager::class, \mod_forum\local\container::get_manager_factory());
  74      }
  75  
  76      /**
  77       * Ensure that a entity factory is returned.
  78       *
  79       * @covers ::get_entity_factory
  80       */
  81      public function test_get_entity_factory() {
  82          $this->assertInstanceOf(\mod_forum\local\factories\entity::class, \mod_forum\local\container::get_entity_factory());
  83      }
  84  
  85      /**
  86       * Ensure that a builder factory is returned.
  87       *
  88       * @covers ::get_builder_factory
  89       */
  90      public function test_get_builder_factory() {
  91          $this->assertInstanceOf(\mod_forum\local\factories\builder::class, \mod_forum\local\container::get_builder_factory());
  92      }
  93  
  94      /**
  95       * Ensure that a url factory is returned.
  96       *
  97       * @covers ::get_url_factory
  98       */
  99      public function test_get_url_factory() {
 100          $this->assertInstanceOf(\mod_forum\local\factories\url::class, \mod_forum\local\container::get_url_factory());
 101      }
 102  }