本文整理汇总了PHP中AdminHandler::getServerVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP AdminHandler::getServerVersion方法的具体用法?PHP AdminHandler::getServerVersion怎么用?PHP AdminHandler::getServerVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AdminHandler
的用法示例。
在下文中一共展示了AdminHandler::getServerVersion方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
public function setUp()
{
$this->connection = getConnection();
$this->collectionHandler = new CollectionHandler($this->connection);
$this->collectionHandler->create('ArangoDB_PHP_TestSuite_IndexTestCollection');
$adminHandler = new AdminHandler($this->connection);
$version = $adminHandler->getServerVersion();
$this->hasSparseIndexes = version_compare($version, '2.5.0') >= 0;
$this->hasSelectivityEstimates = version_compare($version, '2.5.0') >= 0;
}
示例2: setUp
public function setUp()
{
$this->connection = getConnection();
$this->collectionHandler = new CollectionHandler($this->connection);
// clean up first
try {
$this->collectionHandler->drop('ArangoDB_PHP_TestSuite_TestCollection');
} catch (\Exception $e) {
// don't bother us, if it's already deleted.
}
$this->collection = new Collection();
$this->collection->setName('ArangoDB_PHP_TestSuite_TestCollection');
$this->collectionHandler->add($this->collection);
$this->documentHandler = new DocumentHandler($this->connection);
$adminHandler = new AdminHandler($this->connection);
$version = preg_replace("/-[a-z0-9]+\$/", "", $adminHandler->getServerVersion());
$this->hasExportApi = version_compare($version, '2.6.0') >= 0;
}
示例3: testCreateAndDeleteDocumentWithSeveralKeys
/**
* Try to create and delete a document with several keys
*/
public function testCreateAndDeleteDocumentWithSeveralKeys()
{
$connection = $this->connection;
$collection = $this->collection;
$documentHandler = new DocumentHandler($connection);
$keys = array("_", "foo", "bar", "bar:bar", "baz", "1", "0", "a-b-c", "a:b", "this-is-a-test", "FOO", "BAR", "Bar", "bAr");
$adminHandler = new AdminHandler($this->connection);
$version = preg_replace("/-[a-z0-9]+\$/", "", $adminHandler->getServerVersion());
if (version_compare($version, '2.6.0') >= 0) {
// 2.6 will also allow the following document keys, while 2.5 will not
$keys[] = ".";
$keys[] = ":";
$keys[] = "@";
$keys[] = "-.:@";
$keys[] = "foo@bar.baz.com";
$keys[] = ":.foo@bar-bar_bar.baz.com.:";
}
foreach ($keys as $key) {
$document = new Document();
$document->someAttribute = 'someValue';
$document->set('_key', $key);
$documentId = $documentHandler->add($collection->getName(), $document);
$resultingDocument = $documentHandler->get($collection->getName(), $documentId);
$resultingAttribute = $resultingDocument->someAttribute;
$resultingKey = $resultingDocument->getKey();
$this->assertTrue($resultingAttribute === 'someValue', 'Resulting Attribute should be "someValue". It\'s :' . $resultingAttribute);
$this->assertTrue($resultingKey === $key, 'Resulting Attribute should be "someValue". It\'s :' . $resultingKey);
$documentHandler->delete($document);
}
}