diff options
author | Morris Jobke <hey@morrisjobke.de> | 2018-03-13 08:52:24 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-13 08:52:24 +0100 |
commit | 57eaa48e3d368fceac96507675f261b6a5a8b711 (patch) | |
tree | cb5a922f80619de561398db86b3e586040cb763e /tests | |
parent | 3cae27614932d3cb0780018551b14a4139f980fd (diff) | |
parent | a1232f46caba330ea6ada0a112aa1d49a4d23f3b (diff) | |
download | nextcloud-server-57eaa48e3d368fceac96507675f261b6a5a8b711.tar.gz nextcloud-server-57eaa48e3d368fceac96507675f261b6a5a8b711.zip |
Merge pull request #8788 from nextcloud/cleanup-oc_api
Remove unused methods and constants from legacy OC_API
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/APITest.php | 115 |
1 files changed, 0 insertions, 115 deletions
diff --git a/tests/lib/APITest.php b/tests/lib/APITest.php index b1ac8fbb24f..bf6902fde65 100644 --- a/tests/lib/APITest.php +++ b/tests/lib/APITest.php @@ -83,119 +83,4 @@ class APITest extends \Test\TestCase { $this->assertEquals($expected, $this->invokePrivate(new \OC_API, 'isV2', [$request])); } - - function dataProviderTestOneResult() { - return [ - [100, true], - [101, false], - [997, false], - ]; - } - - /** - * @dataProvider dataProviderTestOneResult - * - * @param $statusCode - * @param $succeeded - */ - public function testOneResult($statusCode, $succeeded) { - // Setup some data arrays - $data1 = [ - 'users' => [ - 'tom' => [ - 'key' => 'value', - ], - 'frank' => [ - 'key' => 'value', - ], - ]]; - - // Test merging one success result - $response = $this->buildResponse(true, $data1, $statusCode); - $result = \OC_API::mergeResponses([$response]); - $this->assertEquals($response['response'], $result); - $this->checkResult($result, $succeeded); - } - - function dataProviderTestMergeResponses() { - return [ - // Two shipped success results - [true, 100, true, 100, true], - // Two shipped results, one success and one failure - [true, 100, true, 998, false], - // Two shipped results, both failure - [true, 997, true, 998, false], - // Two third party success results - [false, 100, false, 100, true], - // Two third party results, one success and one failure - [false, 100, false, 998, false], - // Two third party results, both failure - [false, 997, false, 998, false], - // One of each, both success - [false, 100, true, 100, true], - [true, 100, false, 100, true], - // One of each, both failure - [false, 997, true, 998, false], - // One of each, shipped success - [false, 997, true, 100, true], - // One of each, third party success - [false, 100, true, 998, false], - ]; - } - /** - * @dataProvider dataProviderTestMergeResponses - * - * Test the merging of multiple responses - * @param $statusCode1 - * @param $statusCode2 - * @param $succeeded - */ - public function testMultipleMergeResponses($shipped1, $statusCode1, $shipped2, $statusCode2, $succeeded){ - // Tests that app responses are merged correctly - // Setup some data arrays - $data1 = array( - 'users' => array( - 'tom' => array( - 'key' => 'value', - ), - 'frank' => array( - 'key' => 'value', - ), - )); - - $data2 = array( - 'users' => array( - 'tom' => array( - 'key' => 'newvalue', - ), - 'jan' => array( - 'key' => 'value', - ), - )); - - // Two shipped success results - $result = \OC_API::mergeResponses(array( - $this->buildResponse($shipped1, $data1, $statusCode1, "message1"), - $this->buildResponse($shipped2, $data2, $statusCode2, "message2"), - )); - $this->checkResult($result, $succeeded); - $resultData = $result->getData(); - $resultMeta = $result->getMeta(); - $resultHeaders = $result->getHeaders(); - $resultStatusCode = $result->getStatusCode(); - - $this->assertArrayHasKey('jan', $resultData['users']); - $this->assertArrayHasKey('KEY', $resultHeaders); - - // check if the returned status message matches the selected status code - if ($resultStatusCode === 997) { - $this->assertEquals('message1', $resultMeta['message']); - } elseif ($resultStatusCode === 998) { - $this->assertEquals('message2', $resultMeta['message']); - } elseif ($resultStatusCode === 100) { - $this->assertEquals(null, $resultMeta['message']); - } - - } - } |