Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
fesor opened this issue Aug 10, 2015 · 0 comments

Comments

@fesor
Copy link
Owner

fesor commented Aug 10, 2015

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant