Kraken\_Unit\Promise\_Partial\FunctionReducePartial::testApiReduce_ResolvesPromiseWithNull_WhenInputIsEmptyAndNoInitialValueOrPromiseProvided PHP Method

testApiReduce_ResolvesPromiseWithNull_WhenInputIsEmptyAndNoInitialValueOrPromiseProvided() public method

    public function testApiReduce_ResolvesPromiseWithNull_WhenInputIsEmptyAndNoInitialValueOrPromiseProvided()
    {
        $test = $this->getTest();
        // Note: this is different from when.js's behavior!
        // In when.Promise::reduce(), this Promise::doRejects with a TypeError exception (following
        // JavaScript's [].Promise::reduce behavior.
        // We're following PHP's array_Promise::reduce behavior and Promise::doResolve with NULL.
        $mock = $test->createCallableMock();
        $mock->expects($test->once())->method('__invoke')->with($test->identicalTo(null));
        Promise::reduce([], $this->plus())->then($mock);
    }