public function testAddItemToTemplate()
 {
     $math = \Mdanter\Ecc\EccFactory::getAdapter();
     $item = new Uint64($math);
     $template = new Template();
     $this->assertEmpty($template->getItems());
     $this->assertEquals(0, $template->count());
     $template->addItem($item);
     $items = $template->getItems();
     $this->assertEquals(1, count($template));
     $this->assertEquals($item, $items[0]);
 }
 /**
  * Add a vector serializer to the template. A $readHandler must be provided if the
  * template will be used to deserialize a vector, since it's contents are not known.
  *
  * The $readHandler should operate on the parser reference, reading the bytes for each
  * item in the collection.
  *
  * @param  callable $readHandler
  * @return $this
  */
 public function vector(callable $readHandler)
 {
     $this->template->addItem(new Vector(new VarInt($this->math), $readHandler));
     return $this;
 }