Skip to content

More control over output results by providing ResultCollector and output filters #6

@fesor

Description

@fesor

Currently stepler uses step execution results as output provider without any processing (only json_encode in controller which is not so flexible).

What can be done is that we can add ResultCollector component, which will support custom filters for step results and so on:

class FeatureContext implements KernelAwareInterface, ResultCollectorAware
{

    public function setResultCollector(ResultCollector $results)
    {
          $this->results = $results;

          $this->results->resultsProcessor(function ($result, array $options) {
              // options can be used for configuring JMS serializer context or something like that.
              return $this->container->get('jms_serailizer')->serialize($result);
          });
    }

    /**
     * @Givne I have registered user
     * @CollectResult(options={"groups": {"profile", "friends"}})
     */
    function iHaveRegisteredUser()
    {
         $user = $this->container->get('user_registrator')->registerUser();

         return $user;
    }
}

Also it would be nice to collect all results by default with ability to register custom filters in config...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions