'/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:----n42YblbMW0hKlKDNQ3pL8RaxosIoEhb+6WJYyRHlk4dejcvI5aM2FAmdY3e4tTl6U5HMAD1T6QxbljanYPrlz/1ObkmXcojX4LosMuRDP72gdKgvdQ+cf1UVNyQ9Onvp7bz+E1w7OzrmIW7lgPUj2sd1Z30OY0T14zT7xTLuOSWjPRIVUEWNlux74nLCywl+WipA1iGHaX/fC5ZPKIh5d/ZJkrGdMU8oc5uh3qxr2ebtSRZbvR2KwitDW/g9q1N1ariv2e6U+JIFcWxW7vxG8x2EXMHtCELUhx3q20WfMMO4k23pY1px6pASJPg8mBmFKG6wFaBspsYCBFZUB5ieCGUf/QT408MgO6UwzghQcDHjtsqM21BdZR4sJKB274L/WinaAN2jBO5Mo80U6cX64d6kTrh3MAEs3Jmsyg+1RO8dVGfouc+Ag1KYo5oi3qmtEYZJDvZxrjXPizXhftGez7ZqGArTNKJfivzGas3/N/S9FoPqSZUFy1hXLB//5IVXYOkUhXNydUm+2MrJ4TztsCk6xIxumuuHB5qvwfe0Q95sXTPspf/xjmXNw1/34xQKBwJoOU60j9B/j1IjiFR6oJLGLSv1Bot2YY40hg7m4Fbz3GrMwcFFuUq2lZQ4koUpYenpm1ego1vfa2ObdjVT093UUjm4jl+A656EKmEkKPY=----ATTACHMENT:----NTA0OTc5Mjg4ODYwNzY0NSAyMDg4NjM3Mjg1NTY2MDQ5IDY1NjUxMjI2ODI2NjQzNzg=