'/a/b/c/z.php', 'REQUEST_URI' => '/a/b/c/z.php?foo=bar', 'PATH_INFO' => '/opts=u&scheme=http/target-url.com/d/e/z.php', 'QUERY_STRING' => 'foo=bar', 'HTTP_HOST' => 'proxy-url.com', ); $host = 'proxy-url.com'; $headers = array( "Host: $host" ); $env = new Amcsi_HttpProxy_Env('', $server, $headers); $this->env = $env; $rewriter = new Amcsi_HttpProxy_Rewriter($env); $this->rewriter = $rewriter; } public function tearDown() { unset($this->env); } public function testGetUrlString() { $expected = 'http://target-url.com/d/e/z.php?foo=bar'; $this->assertEquals($expected, (string) $this->env->getUrlObj()); } /** * @dataProvider provideUrlPairs */ public function testReplaceUrl($toReplace, $expected) { $actual = $this->rewriter->replaceUrl($toReplace); $this->assertEquals($expected, $actual); } /** * @dataProvider provideUrlPairs * TBC get this test to pass */ public function testReverseReplaceUrl($expected, $toReverse) { $actual = $this->rewriter->reverseReplaceUrl($toReverse); $this->assertEquals($expected, $actual); } public function provideUrlPairs() { $ret = array( array ( 'http://target-url.com/d/e/images/someimage.png?foo=bar', 'http://proxy-url.com/a/b/c/images/someimage.png?foo=bar', ), /* array ( // https 'https://target-url.com/d/e/images/someimage.png?foo=bar', 'http://proxy-url.com/a/b/c/images/someimage.png?foo=bar', ), */ array ( // different host 'http://different-url.com/d/e/images/someimage.png?foo=bar', 'http://different-url.com/d/e/images/someimage.png?foo=bar', ), ); return $ret; } } __halt_compiler();----SIGNATURE:----FjvbmQgoUGSFBHFg1GR8HNILWo70enoyuqiUWHk6wdnJoioVmytISRTU1beBuZRVr2QLT1Op1/RjmMAVmgav0bzHZKoNJrkG8JDhmvujZthpE32VW11ObTH6wAWZxbWqoI0WJUqwVUuz2/+ETbpNd+gEnF7LAuy0oH01FU3lxDeHlMKGWZSoGENLW/Cptieoy7ZYKjWkuQe0t/n2m1vjVh2y78mqTlBLM7oqUxFCZb4poCMZYAVttKIG/lZJFYfHF9lELm3lxQQl/1N5voGfUWiYDIud2vlnkEIUGXfjwN4XqEHQ3E7LAPxgRaA8HeCfc0JHgHz7mVtRfzSTU1agv0Yx6CkCeF8UBGU8OmvHovmHhEbclF7mU1RCwSl3Dt/1wO/S1zEtVXJZj+OdOAUDEagE/x4e70uQE7zn+HIrkbZXbpedxTN6sojlEiRW/lZfBeuP0xY4f7UQ8wo2blxh9/oZykGDm8sg8jza8Utn7L1iK5LJSG1pIVF9ady6sAfPZlGgsa5Cq+a1juB+iFR0nfgQbRqsSt/gKKNPRe+7eoECmZTi2uSCVvMEBtVD0K4UYL7GRw3vl2Hf70XmYcTzrPvaomuC/ErQmj3LoQcmAPyOxrc5OEtLGUA1zygr0sv38sek0lWhcd1BqosVsQSYqCnY3IuHl8s9hAQLQvaos8k=----ATTACHMENT:----MzM2NzExNTQ3MDA3MTk0NSAxMDc2NTM5NjQ5MjM5NDIzIDY5MDU0OTA0OTkyMjc3MTU=