Esempio n. 1
0
 public function __construct($model = null)
 {
     if (!empty($model)) {
         $this->models[] = $model;
     }
     if (!empty($model)) {
         $this->manganel = Manganel::create($model);
     } else {
         $this->manganel = Manganel::fly();
     }
 }
Esempio n. 2
0
 public function __construct($model)
 {
     $this->model = $model;
     $this->meta = ManganelMeta::create($this->model);
     if (!empty($this->meta->type()->indexId) && false !== $this->meta->type()->indexId) {
         $this->isIndexable = true;
     }
     if ($this->isIndexable) {
         if (!isset($this->model->_id)) {
             throw new ManganelException(sprintf('Property `_id` is not set in model `%s`, this is required by Manganel', get_class($this->model)));
         }
         $this->manganel = Manganel::create($this->model);
     }
 }
Esempio n. 3
0
 public function testIfWillDropIndex()
 {
     $model = new SimpleModel();
     $model->_id = new MongoId();
     $model->title = 'Jersey';
     $im = new IndexManager($model);
     $im->index();
     $found = $im->get();
     // Check if is indexed
     $this->assertTrue($found instanceof SimpleModel);
     $this->assertSame($model->title, $found->title);
     $result = Manganel::create($model)->drop();
     codecept_debug($result);
     try {
         $im->get();
         $this->assertFalse(true);
     } catch (Missing404Exception $ex) {
         $this->assertTrue(true);
     }
 }