Пример #1
0
 public function testStat()
 {
     $value = $this->faker->word;
     $name = $this->faker->word;
     $description = $this->faker->word;
     $stat = new Stat($value, $name, $description);
     $this->assertSame($name, $stat->getName());
     $this->assertSame($description, $stat->getDescription());
     $stat->setName($name)->setDescription($description);
     $this->assertSame($name, $stat->getName());
     $this->assertSame($description, $stat->getDescription());
     $xml = '<?xml version="1.0"?>' . "\n" . '<stat name="' . $name . '" description="' . $description . '">' . $value . '</stat>';
     $this->assertXmlStringEqualsXmlString($xml, (string) $stat);
     $array = ['stat' => ['name' => $name, 'description' => $description, '_content' => $value]];
     $this->assertEquals($array, $stat->toArray());
 }
Пример #2
0
 /**
  * Add an attr
  *
  * @param  Stat $stat
  * @return self
  */
 public function addStat(Stat $stat)
 {
     $this->_stats->add($stat);
     return $this;
 }