Exemplo n.º 1
0
 public function testItems()
 {
     $s = new Section();
     $this->assertEmpty($s->getItems());
     $i1 = new Item();
     $s->addItem($i1);
     $this->assertCount(1, $s->getItems());
     $this->assertSame($i1, $s->getItems()[0]);
     $i2 = new Item();
     $s->addItem($i2);
     $this->assertCount(2, $s->getItems());
     $this->assertSame($i1, $s->getItems()[0]);
     $this->assertSame($i2, $s->getItems()[1]);
 }
Exemplo n.º 2
0
 /**
  * {@inheritdoc}
  */
 public function createSection(array $checkList)
 {
     ArrayArgument::requireKeys('First argument', ['name', 'checkItems'], $checkList);
     $section = new Section();
     $section->name = $checkList['name'];
     foreach ((array) $checkList['checkItems'] as $checkItem) {
         $section->addItem($this->createItem($checkItem));
     }
     return $section;
 }