Esempio n. 1
0
 public function testReading()
 {
     $reading = new Reading('key', 'value', 'date');
     $this->assertSame('key', $reading->getKey());
     $this->assertSame('key', $reading->getName());
     $this->assertSame('value', $reading->getValue());
     $this->assertSame('date', $reading->getDate());
 }
Esempio n. 2
0
 /**
  * @param Reading $reading
  * @return mixed
  * @throws UnknownReadingException
  */
 public function addReading(Reading $reading)
 {
     if (!in_array($reading->getKey(), $this->getReadingKeys())) {
         throw new UnknownReadingException($reading->getKey());
     }
     return $this->readings[$reading->getKey()] = $reading;
 }