2015-08-03 10:05:50 -04:00
|
|
|
<?php
|
|
|
|
|
/**
|
2024-05-10 09:09:14 -04:00
|
|
|
* SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2015-08-03 10:05:50 -04:00
|
|
|
*/
|
|
|
|
|
|
2016-05-19 05:09:38 -04:00
|
|
|
namespace Test\OCS;
|
|
|
|
|
|
|
|
|
|
use OCP\AppFramework\Http;
|
|
|
|
|
|
|
|
|
|
class MapStatusCodeTest extends \Test\TestCase {
|
2015-08-03 10:05:50 -04:00
|
|
|
/**
|
|
|
|
|
* @dataProvider providesStatusCodes
|
|
|
|
|
*/
|
|
|
|
|
public function testStatusCodeMapper($expected, $sc) {
|
2016-05-19 05:09:38 -04:00
|
|
|
$result = \OC_API::mapStatusCodes($sc);
|
2015-08-03 10:05:50 -04:00
|
|
|
$this->assertEquals($expected, $result);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function providesStatusCodes() {
|
|
|
|
|
return [
|
|
|
|
|
[Http::STATUS_OK, 100],
|
|
|
|
|
[Http::STATUS_BAD_REQUEST, 104],
|
2015-08-05 11:49:44 -04:00
|
|
|
[Http::STATUS_BAD_REQUEST, 1000],
|
2015-08-05 05:23:29 -04:00
|
|
|
[201, 201],
|
2015-08-03 10:05:50 -04:00
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|