/**
  * @param array $constraints
  *
  * @return \Melody\Validation\Common\Collections\ConstraintsCollection
  */
 protected function parseConstraints(array $constraints)
 {
     $constraintsCollection = new ConstraintsCollection();
     foreach ($constraints as $id => $constraint) {
         $constraintsCollection->set($id, $constraint);
     }
     return $constraintsCollection;
 }
 public function testValidationGroupsMethods()
 {
     $constraintsCollection = new ConstraintsCollection();
     $constraintsCollection->set('name', v::maxLength(50));
     $constraintsCollection->set('email', v::email()->maxLength(50));
     $validationGroups = new ValidationGroups();
     $validationGroups->add("registering", $constraintsCollection);
     $this->assertTrue($validationGroups->has("registering"));
     $this->assertInstanceOf('Melody\\Validation\\Common\\Collections\\ConstraintsCollection', $validationGroups->get("registering"));
     $validationGroups->remove("registering");
     $this->assertFalse($validationGroups->has("registering"));
     $this->setExpectedException('InvalidArgumentException');
     $this->assertInstanceOf('InvalidArgumentException', $validationGroups->get("registering"));
 }