Skip to content

async-interop/promise-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

5741721 · Jan 7, 2017

History

18 Commits
Jan 7, 2017
Oct 24, 2016
Oct 24, 2016
Dec 23, 2016
Jan 7, 2017

Repository files navigation

Promise Tests

This package provides a quite extensive phpunit test suite to be used against Promise implementations from the async-interop/promise package.

Usage

class MyDriverTest extends \Interop\Async\Promise\Test {
    function getFactory() {
        return new MyDriverFactory;
    }
    
    function getPromise() {
        $resolver = new MyPromiseResolver;
        return [
            $resolver->promise(),
            function($v) use ($resolver) { $resolver->succeed($v); },
            function($e) use ($resolver) { $resolver->fail($e); },
        ];
    }
}

That's it. Put it in your tests folder with an appropriate phpunit setup and run it.