/** * Test if Databases can still be created, if current is not _system */ public function testCreateDatabaseSwitchToItAndCreateAnotherOne() { $database = 'ArangoTestSuiteDatabaseTest01'; $database2 = 'ArangoTestSuiteDatabaseTest02'; try { $e = null; Database::delete($this->connection, $database); } catch (\Exception $e) { // don't bother us... } $response = Database::create($this->connection, $database); $this->assertTrue($response['error'] == false, 'result[\'error\'] Did not return false, instead returned: ' . print_r($response, 1)); // Try to create a database from within a non_system database $this->connection->setDatabase($database); $response = Database::getInfo($this->connection); $this->assertTrue($response['result']['name'] == $database); try { $e = null; $response = Database::create($this->connection, $database2); } catch (\Exception $e) { // don't bother us... just give us the $e } $this->assertInstanceOf('triagens\\ArangoDb\\ServerException', $e); $this->assertTrue($e->getCode() == 403, 'Should be 403, instead got: ' . $e->getCode()); $this->connection->setDatabase('_system'); $response = Database::getInfo($this->connection); $this->assertTrue($response['result']['name'] == '_system'); $response = Database::delete($this->connection, $database); $this->assertTrue($response['error'] == false, 'result[\'error\'] Did not return false, instead returned: ' . print_r($response, 1)); }