subject = new RequestRebuilder(); } /** * @dataProvider urlHeaderProvider */ public function testRebuild(string $url, array $headers, string $expectedUrl): void { $request = $this->subject->rebuild(new Request('get', $url, $headers)); $this->assertEquals($expectedUrl, (string)$request->getUri()); } public function urlHeaderProvider(): array { return [ ['http://tao.lu', [], 'http://tao.lu'], ['https://tao.lu', [], 'https://tao.lu'], [ 'http://tao.lu', ['x-forwarded-proto' => 'https'], 'https://tao.lu' ], [ 'http://tao.lu', ['x-forwarded-proto' => null], 'http://tao.lu' ], [ 'http://tao.lu', ['x-forwarded-ssl' => 'on'], 'https://tao.lu' ], [ 'http://tao.lu', ['x-forwarded-ssl' => null], 'http://tao.lu' ], ]; } }