From 3a66c58eefd449ed9444c549791dff0657b6c491 Mon Sep 17 00:00:00 2001 From: Bjoern Schiessle Date: Wed, 10 Aug 2016 15:29:13 +0200 Subject: [PATCH] use the new OCS Data Response --- lib/Controller/ApiController.php | 30 ++++++++++------------ tests/lib/Controller/ApiControllerTest.php | 20 +++++++-------- 2 files changed, 24 insertions(+), 26 deletions(-) diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index 931ce31d..87572389 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -91,22 +91,20 @@ public function __construct($appName, public function info() { return new DataResponse( - ['data' => - [ - 'nextcloud' => - [ - 'system' => $this->systemStatistics->getSystemStatistics(), - 'storage' => $this->storageStatistics->getStorageStatistics(), - 'shares' => $this->shareStatistics->getShareStatistics() - ], - 'server' => - [ - 'webserver' => $this->getWebserver(), - 'php' => $this->phpStatistics->getPhpStatistics(), - 'database' => $this->databaseStatistics->getDatabaseStatistics() - ], - 'activeUsers' => $this->sessionStatistics->getSessionStatistics() - ] + [ + 'nextcloud' => + [ + 'system' => $this->systemStatistics->getSystemStatistics(), + 'storage' => $this->storageStatistics->getStorageStatistics(), + 'shares' => $this->shareStatistics->getShareStatistics() + ], + 'server' => + [ + 'webserver' => $this->getWebserver(), + 'php' => $this->phpStatistics->getPhpStatistics(), + 'database' => $this->databaseStatistics->getDatabaseStatistics() + ], + 'activeUsers' => $this->sessionStatistics->getSessionStatistics() ] ); diff --git a/tests/lib/Controller/ApiControllerTest.php b/tests/lib/Controller/ApiControllerTest.php index 7073a021..b891c248 100644 --- a/tests/lib/Controller/ApiControllerTest.php +++ b/tests/lib/Controller/ApiControllerTest.php @@ -122,16 +122,16 @@ public function testInfo() { $result = $this->instance->info(); $this->assertTrue($result instanceof DataResponse); $data = $result->getData(); - $this->assertTrue(isset($data['data']['nextcloud'])); - $this->assertTrue(isset($data['data']['server'])); - - $this->assertSame('systemStatistics', $data['data']['nextcloud']['system']); - $this->assertSame('storageStatistics', $data['data']['nextcloud']['storage']); - $this->assertSame('shareStatistics', $data['data']['nextcloud']['shares']); - $this->assertSame('unknown', $data['data']['server']['webserver']); - $this->assertSame('databaseStatistics', $data['data']['server']['database']); - $this->assertSame('phpStatistics', $data['data']['server']['php']); - $this->assertSame('sessionStatistics', $data['data']['activeUsers']); + $this->assertTrue(isset($data['nextcloud'])); + $this->assertTrue(isset($data['server'])); + + $this->assertSame('systemStatistics', $data['nextcloud']['system']); + $this->assertSame('storageStatistics', $data['nextcloud']['storage']); + $this->assertSame('shareStatistics', $data['nextcloud']['shares']); + $this->assertSame('unknown', $data['server']['webserver']); + $this->assertSame('databaseStatistics', $data['server']['database']); + $this->assertSame('phpStatistics', $data['server']['php']); + $this->assertSame('sessionStatistics', $data['activeUsers']); } }