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 // phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace 18 19 use Behat\Behat\Hook\Scope\BeforeScenarioScope; 20 use communication_matrix\matrix_test_helper_trait; 21 use Moodle\BehatExtension\Exception\SkippedException; 22 23 require_once (__DIR__ . '/../matrix_test_helper_trait.php'); 24 require_once (__DIR__ . '/../../../../../lib/behat/behat_base.php'); 25 require_once (__DIR__ . '/../../../../tests/communication_test_helper_trait.php'); 26 27 /** 28 * Class behat_communication_matrix for behat custom steps and configuration for matrix. 29 * 30 * @package communication_matrix 31 * @category test 32 * @copyright 2023 Safat Shahin <safat.shahin@moodle.com> 33 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later 34 */ 35 class behat_communication_matrix extends \behat_base { 36 use \core_communication\communication_test_helper_trait; 37 use matrix_test_helper_trait; 38 39 /** 40 * BeforeScenario hook to reset the mock server. 41 * 42 * @BeforeScenario @communication_matrix 43 * 44 * @param BeforeScenarioScope $scope 45 */ 46 public function before_scenario(BeforeScenarioScope $scope) { 47 if (defined('TEST_COMMUNICATION_MATRIX_MOCK_SERVER')) { 48 $this->reset_mock(); 49 } 50 } 51 52 /** 53 * Setup and configure and mock server for matrix. 54 * 55 * @Given /^a Matrix mock server is configured$/ 56 */ 57 public function initialize_mock_server(): void { 58 if (!defined('TEST_COMMUNICATION_MATRIX_MOCK_SERVER')) { 59 throw new SkippedException( 60 'The TEST_COMMUNICATION_MATRIX_MOCK_SERVER constant must be defined to run communication_matrix tests' 61 ); 62 } 63 $this->setup_communication_configs(); 64 $this->initialise_mock_configs(); 65 } 66 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body