Esempio n. 1
0
 public function testWriteConvertsDateTimeToMongoDate()
 {
     $date = new DateTime();
     $event = array('timestamp' => $date);
     $this->mongoCollection->expects($this->once())->method('save')->with($this->contains(new MongoDate($date->getTimestamp()), false));
     $writer = new MongoDBWriter($this->mongo, $this->database, $this->collection);
     $writer->write($event);
 }
Esempio n. 2
0
 public function testWriteWithCustomSaveOptions()
 {
     $event = array('message' => 'foo', 'priority' => 42);
     $saveOptions = array('safe' => false, 'fsync' => false, 'timeout' => 100);
     $this->mongoCollection->expects($this->once())->method('save')->with($event, $saveOptions);
     $writer = new MongoDBWriter($this->mongo, $this->database, $this->collection, $saveOptions);
     $writer->write($event);
 }