/** * @test */ public function shouldAllowCreatePayoutToken() { $gatewayName = 'theGatewayName'; $model = new \stdClass(); $payoutPath = 'thePayoutPath'; $afterPath = 'theAfterPath'; $afterUrl = 'theAfterUrl'; $afterParameters = array('after' => 'val'); $afterToken = new Token(); $afterToken->setTargetUrl($afterUrl); $payoutToken = new Token(); $tokenFactoryMock = $this->createTokenFactoryMock(); $tokenFactoryMock->expects($this->at(0))->method('createToken')->with($gatewayName, $this->identicalTo($model), $afterPath, $afterParameters, null, [])->willReturn($afterToken); $tokenFactoryMock->expects($this->at(1))->method('createToken')->with($gatewayName, $this->identicalTo($model), $payoutPath, [], $afterUrl, [])->willReturn($payoutToken); $factory = new GenericTokenFactory($tokenFactoryMock, array('payout' => $payoutPath)); $actualToken = $factory->createPayoutToken($gatewayName, $model, $afterPath, $afterParameters); $this->assertSame($payoutToken, $actualToken); }