Git Product home page Git Product logo

behat2's People

Contributors

rudiedirkx avatar

Watchers

 avatar

behat2's Issues

What about a multiple return value?

Let's say we have a step:

Given there is a user "Fred" in organization "Fred's Org" 

Which is the return value? The user or the organization? What if I want to save both, one in "USER" and one in "ORG"?

  • How to make the step return 2 values?
  • How to differentiate between them in the storage step?

Allow only scalars in storage

A step's return value can be anything, but if it's saved in storage, it must be a scalar, because it will be used as string.

Step: [And] expect the following "1" steps to fail

Use extension to register service:

Behat\Testwork\Call\ServiceContainer\CallExtension:
  call.result_filter:
    - Behat\Testwork\Call\Filter\ResultFilter
    - Behat\Testwork\Call\CallCenter::filterResult()

Implementation:

interface ResultFilter {
    /**
     * Checks if filter supports call result.
     *
     * @param CallResult $result
     *
     * @return Boolean
     */
    public function supportsResult(CallResult $result);

    /**
     * Filters call result and returns a new result.
     *
     * @param CallResult $result
     *
     * @return CallResult
     */
    public function filterResult(CallResult $result);
}

Caller:


/**
 * Filters call result using registered filters and returns a filtered one.
 *
 * @param CallResult $result
 *
 * @return CallResult
 */
private function filterResult(CallResult $result) {
    foreach ($this->resultFilters as $filter) {
        if (!$filter->supportsResult($result)) {
            continue;
        }

        return $filter->filterResult($result);
    }

    return $result;
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.