assertEquals($expectedUri, (string) $request->getUri()); $this->assertEquals('Bearer ' . $expectedAccessToken, $request->getHeaderLine('Authorization')); $this->assertEquals([ 'delegates' => $expectedDelegates, 'payload' => base64_encode($expectedString) ], json_decode((string) $request->getBody(), true)); return new Psr7\Response(200, [], Psr7\stream_for(json_encode([ 'signedBlob' => $expectedResponse ]))); }; $iam = new Iam($httpHandler); $res = $iam->signBlob( $expectedEmail, $expectedAccessToken, $expectedString, $delegates ); $this->assertEquals($expectedResponse, $res); } public function delegates() { return [ [], [['foo@bar.com']], [ [ 'foo@bar.com', 'bar@bar.com' ] ], ]; } }