Proyectos de Subversion Moodle

Rev

| Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1441 ariadna 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 core\router\response;
18
 
19
use core\exception\access_denied_exception;
20
use core\router\schema\response\payload_response;
21
use core\router\schema\specification;
22
use core\tests\router\route_testcase;
23
use GuzzleHttp\Psr7\ServerRequest;
24
 
25
/**
26
 * Tests for the access denied response.
27
 *
28
 * @package    core
29
 * @copyright  Andrew Lyons <andrew@nicols.co.uk>
30
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
31
 * @covers     \core\router\response\empty_response
32
 */
33
final class empty_response_test extends route_testcase {
34
    public function test_basics(): void {
35
        $response = new empty_response();
36
        $this->assertIsInt($response->get_status_code());
37
        $this->assertEquals(204, $response->get_status_code());
38
    }
39
 
40
    public function test_openapi_description(): void {
41
        $response = new empty_response();
42
        $openapi = $response->get_openapi_description(new specification());
43
 
44
        // The OpenAPI description should be present.
45
        // Note: We do not need to test the value of it. Doing so just reduces maintainability.
46
        $this->assertIsString($openapi->description);
47
    }
48
}