MapStatusCodeTest.php 651 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2023-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace Test\OCS;
  8. use OCP\AppFramework\Http;
  9. class MapStatusCodeTest extends \Test\TestCase {
  10. /**
  11. * @dataProvider providesStatusCodes
  12. */
  13. public function testStatusCodeMapper($expected, $sc) {
  14. $result = \OC_API::mapStatusCodes($sc);
  15. $this->assertEquals($expected, $result);
  16. }
  17. public function providesStatusCodes() {
  18. return [
  19. [Http::STATUS_OK, 100],
  20. [Http::STATUS_BAD_REQUEST, 104],
  21. [Http::STATUS_BAD_REQUEST, 1000],
  22. [201, 201],
  23. ];
  24. }
  25. }