示例#1
0
 public function testMultipleNamesAndAverageNameLength()
 {
     @($cat = new Cat());
     $names = ['Chaos', 'Chocolate', 'Felix', 'Garfield', 'Nermal', 'Scratchy'];
     $totalLength = 0;
     foreach ($names as $name) {
         $cat->setName($name);
         $totalLength += strlen($name);
     }
     $allNames = $cat->getNames();
     $this->assertEquals(implode(',', $names), $allNames);
     $this->assertEquals($totalLength / count($names), $cat->getAverageNameLength());
 }