Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 38... Línea 38...
38
     * @param string $id The ID of the node
38
     * @param string $id The ID of the node
39
     * @param string $name The name of the node
39
     * @param string $name The name of the node
40
     * @param string $rootpath The path to append the node on
40
     * @param string $rootpath The path to append the node on
41
     * @param string $expected The expected node path
41
     * @param string $expected The expected node path
42
     */
42
     */
43
    public function test_build_node_path(string $id, string $name, string $rootpath, string $expected) {
43
    public function test_build_node_path(string $id, string $name, string $rootpath, string $expected): void {
44
        // Assert that the returned node path is equal to the expected one.
44
        // Assert that the returned node path is equal to the expected one.
45
        $this->assertEquals($expected, helper::build_node_path($id, $name, $rootpath));
45
        $this->assertEquals($expected, helper::build_node_path($id, $name, $rootpath));
46
    }
46
    }
Línea 47... Línea 47...
47
 
47
 
Línea 93... Línea 93...
93
     *
93
     *
94
     * @dataProvider explode_node_path_provider
94
     * @dataProvider explode_node_path_provider
95
     * @param string $node The node string to extract information from
95
     * @param string $node The node string to extract information from
96
     * @param array $expected The expected array containing the information about the node
96
     * @param array $expected The expected array containing the information about the node
97
     */
97
     */
98
    public function test_explode_node_path(string $node, array $expected) {
98
    public function test_explode_node_path(string $node, array $expected): void {
99
        // Assert that the returned array is equal to the expected one.
99
        // Assert that the returned array is equal to the expected one.
100
        $this->assertEquals($expected, helper::explode_node_path($node));
100
        $this->assertEquals($expected, helper::explode_node_path($node));
101
    }
101
    }
Línea 102... Línea 102...
102
 
102
 
Línea 138... Línea 138...
138
     *
138
     *
139
     * @dataProvider get_browser_provider
139
     * @dataProvider get_browser_provider
140
     * @param string $nodepath The node path string
140
     * @param string $nodepath The node path string
141
     * @param string $expected The expected browser class
141
     * @param string $expected The expected browser class
142
     */
142
     */
143
    public function test_get_browser(string $nodepath, string $expected) {
143
    public function test_get_browser(string $nodepath, string $expected): void {
144
        // The service (rest API) object is required by get_browser(), but not being used to determine which browser
144
        // The service (rest API) object is required by get_browser(), but not being used to determine which browser
145
        // object should be returned. Therefore, we can simply mock this object in this test.
145
        // object should be returned. Therefore, we can simply mock this object in this test.
146
        $servicemock = $this->createMock(rest::class);
146
        $servicemock = $this->createMock(rest::class);
147
        $browser = helper::get_browser($servicemock, $nodepath);
147
        $browser = helper::get_browser($servicemock, $nodepath);
Línea 190... Línea 190...
190
     *
190
     *
191
     * @dataProvider get_node_provider
191
     * @dataProvider get_node_provider
192
     * @param \stdClass $gdcontent The Google Drive content (file/folder) object
192
     * @param \stdClass $gdcontent The Google Drive content (file/folder) object
193
     * @param string $expected The expected content node class
193
     * @param string $expected The expected content node class
194
     */
194
     */
195
    public function test_get_node(\stdClass $gdcontent, string $expected) {
195
    public function test_get_node(\stdClass $gdcontent, string $expected): void {
196
        // The path is required by get_content_node(), but not being used to determine which content node
196
        // The path is required by get_content_node(), but not being used to determine which content node
197
        // object should be returned. Therefore, we can just generate a dummy path.
197
        // object should be returned. Therefore, we can just generate a dummy path.
198
        $path = \repository_googledocs::REPOSITORY_ROOT_ID . '|Google+Drive|' .
198
        $path = \repository_googledocs::REPOSITORY_ROOT_ID . '|Google+Drive|' .
199
            \repository_googledocs::MY_DRIVE_ROOT_ID . '|My+Drive';
199
            \repository_googledocs::MY_DRIVE_ROOT_ID . '|My+Drive';
200
        $node = helper::get_node($gdcontent, $path);
200
        $node = helper::get_node($gdcontent, $path);
Línea 230... Línea 230...
230
     *
230
     *
231
     * @dataProvider request_exception_provider
231
     * @dataProvider request_exception_provider
232
     * @param \Exception $exception The exception thrown by the API call
232
     * @param \Exception $exception The exception thrown by the API call
233
     * @param \Exception $expected The expected exception thrown by request()
233
     * @param \Exception $expected The expected exception thrown by request()
234
     */
234
     */
235
    public function test_request_exception(\Exception $exception, \Exception $expected) {
235
    public function test_request_exception(\Exception $exception, \Exception $expected): void {
236
        // Mock the service object.
236
        // Mock the service object.
237
        $servicemock = $this->createMock(rest::class);
237
        $servicemock = $this->createMock(rest::class);
Línea 238... Línea 238...
238
 
238
 
239
        // Assert that the call() method is being called only once with the given arguments.
239
        // Assert that the call() method is being called only once with the given arguments.