/**
  * @param JsonApiSerializer $serializer
  * @param Fields            $fields
  * @param string            $paramName
  */
 protected function validateFieldsQueryParams($serializer, Fields $fields, $paramName)
 {
     if (false === $fields->isEmpty()) {
         $validateFields = $fields->types();
         foreach ($validateFields as $key => $field) {
             $mapping = $serializer->getTransformer()->getMappingByAlias($field);
             if (null !== $mapping) {
                 $properties = $this->getPropertiesFromMapping($mapping);
                 $invalidProperties = array_diff($fields->members($field), $properties);
                 $this->addInvalidParameterMemberErrorsToErrorBag($invalidProperties, $paramName, $field);
                 unset($validateFields[$key]);
             }
         }
         $this->addInvalidParameterErrorsToErrorBag($paramName, $validateFields);
     }
 }
 /**
  * @param JsonApiSerializer $serializer
  * @param Fields            $fields
  * @param                   $paramName
  * @param ErrorBag          $errorBag
  */
 protected static function validateQueryParamsTypes(JsonApiSerializer $serializer, Fields $fields, $paramName, ErrorBag $errorBag)
 {
     if (false === $fields->isEmpty()) {
         $transformer = $serializer->getTransformer();
         $validateFields = $fields->types();
         foreach ($validateFields as $key => $type) {
             $mapping = $transformer->getMappingByAlias($type);
             if (null !== $mapping) {
                 $members = array_merge(array_combine($mapping->getProperties(), $mapping->getProperties()), $mapping->getAliasedProperties());
                 $invalidMembers = array_diff($fields->members($type), $members);
                 foreach ($invalidMembers as $extraField) {
                     $errorBag[] = new InvalidParameterMemberError($extraField, $type, strtolower($paramName));
                 }
                 unset($validateFields[$key]);
             }
         }
         if (false === empty($validateFields)) {
             foreach ($validateFields as $type) {
                 $errorBag[] = new InvalidParameterError($type, strtolower($paramName));
             }
         }
     }
 }
 public function testItWillReturnMemberNames()
 {
     $expected = ['employee'];
     $this->assertEquals($expected, $this->fields->types());
 }