Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
   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 tool_brickfield\local\tool;
  18  
  19  /**
  20   * Unit tests for {@checktyperesults tool_brickfield\local\tool\checktyperesults\tool}.
  21   *
  22   * @package   tool_brickfield
  23   * @copyright  2020 onward: Brickfield Education Labs, www.brickfield.ie
  24   * @author     Jay Churchward (jay.churchward@poetopensource.org)
  25   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  26   */
  27  class checktyperesults_test extends \advanced_testcase {
  28  
  29      public function test_toolname() {
  30          $this->resetAfterTest();
  31  
  32          $object = new checktyperesults();
  33          $output = $object->toolname();
  34          $this->assertEquals($output, 'Content types summary');
  35      }
  36  
  37      public function test_toolshortname() {
  38          $this->resetAfterTest();
  39  
  40          $object = new checktyperesults();
  41          $output = $object->toolshortname();
  42          $this->assertEquals($output, 'Content types');
  43      }
  44  
  45      public function test_pluginname() {
  46          $this->resetAfterTest();
  47  
  48          $object = new checktyperesults();
  49          $output = $object->pluginname();
  50          $this->assertEquals($output, 'checktyperesults');
  51      }
  52  
  53      public function test_get_output() {
  54          $this->resetAfterTest();
  55          $category = $this->getDataGenerator()->create_category();
  56  
  57          $filter = new filter(1, $category->id, 'checktyperesults', 3, 4);
  58          $filter->courseids = [];
  59  
  60          $object = new checktyperesults();
  61          $object->set_filter($filter);
  62          $object->get_data();
  63          $output = $object->get_output();
  64          $this->assertIsString($output);
  65          $this->assertStringContainsString('Results per content type:', $output);
  66      }
  67  }