コード例 #1
0
 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
0
 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
0
 /**
  * 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[] = "*****@*****.**";
         $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);
     }
 }