Esempio n. 1
0
 public function testUnitCreation()
 {
     $metadata = array();
     $u = new Unit(self::DOMAIN, self::KEY, $metadata);
     $this->assertEquals(self::DOMAIN, $u->getDomain());
     $this->assertEquals(self::KEY, $u->getKey());
     $this->assertEquals($metadata, $u->getMetadata());
     $this->assertEquals('-', $u->getHelp());
     $metadata = array('some_metadata' => 'fancy data', 'another' => 'more fancy data', 'note' => 'You can use a placeholder %price%');
     $u = new Unit(self::DOMAIN, self::KEY, $metadata);
     $this->assertEquals($metadata, $u->getMetadata());
     $this->assertEquals('You can use a placeholder %price%', $u->getHelp());
 }
 /**
  * Update the current object from a ModelUnit
  *
  * @param ModelUnit $unit
  */
 public function updateFromModel(ModelUnit $unit)
 {
     $this->setDomain($unit->getDomain());
     $this->setKey($unit->getKey());
     $this->setMetadata($unit->getMetadata());
 }
 public function deleteUnit(Unit $unit)
 {
     UnitQuery::create()->findOneByDomainAndKey($unit->getDomain(), $unit->getKey())->delete();
 }