Exemplo n.º 1
0
 /**
  * Test Document preparation and conversion.
  */
 public function testPrepareDocument()
 {
     $some_data = DataProvider::getStandardData();
     $document = DocumentFactory::init($this->config)->prepareDocument($some_data);
     $this->assertEquals('Vultan\\Document\\Document', get_class($document));
     $this->assertEquals('Mercedes-Benz', $document->get('marque'));
 }
Exemplo n.º 2
0
 /**
  * Prepare the query.
  *
  * @param mixed $data
  *   The data.
  * @param array $filter
  *   Any filter values to pass to mongo.
  * @param array $options
  *   Any options to pass to Mongo.
  *
  * @return QueryInterface
  *   This Query object.
  */
 public function query($data, array $filter = array(), array $options = array())
 {
     if (!empty($options)) {
         foreach ($options as $key => $value) {
             $this->setOption($key, $value);
         }
     }
     $this->filter = $filter;
     // Ensure we have a properly prepared Document.
     $this->document = DocumentFactory::init($this->getConfig())->prepareDocument($data);
     return $this;
 }
Exemplo n.º 3
0
 /**
  * Return the Document Factory service.
  *
  * @return DocumentFactory
  *   A DocumentFactory object.
  */
 public function getDocumentFactory()
 {
     return DocumentFactory::init($this->getConfig());
 }
Exemplo n.º 4
0
 public function testCreateDocument()
 {
     $factory = DocumentFactory::init($this->config);
     $document = $factory->createDocument();
     $this->assertEquals('Vultan\\Document\\Document', get_class($document));
 }