public function get($key) { $collection = $this->getCollectionName(); $result = $this->mongo->{$collection}->findOne(['name' => $key]); if (!$result) { return null; } return $result['value']; }
public function testGetNoValue() { $adapter = new MongoDBStorageAdapter($this->mongo); $this->mongo->coll->method('findOne')->will($this->returnValue(null)); $result = $adapter->get('key'); $this->assertSame(true, $result); }