Re: Thinking About A PEAR Package - Looking For Comments
| From: | Bill Shupp | Date: | Sun, 06 Sep 2009 17:28:25 +0000 |
| Subject: | Re: Thinking About A PEAR Package - Looking For Comments | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-52771@lists.php.net to get a copy of this message | ||
On Sep 6, 2009, at 10:23 AM, Brandon Savage wrote:
OK. I'll try and get it up on Digg's github repo this week. One thing that would be handy to add is using php://input to populate a POST superglobal in this framework. I'm so tired of . being translated to _ in $_POST keys. :( Cheers, BillBrandon, At Digg I wrote a package called PHP_SuperGlobals. The main use case was so that I could mock setcookie(), as such calls were breaking unit tests (sending headers). So in your code you would do something like: $cookie = PHP_SuperGlobals::singleton('Cookie'); or $cookie = PHP_SuperGlobals::singleton('CookieMock'); $cookie->setcookie('/', 'foo'); That sort of thing. It has support for $_GET, $_POST, $_COOKIE, and I think $_SERVER. We've gotten pretty used to using it for all of those for mocking input, as well as the setcookie case. But there's a decent interface for customizing it for your needs (IMO). I'm pretty sure this is decoupled from Digg code, and would be willing to make it available if anyone has interest in it. Thoughts? Cheers, BillBill, I think that'd be great. I'd love to take a look at it, and see if it fits a good starting point. I've got a particular idea of what I'm looking for, but I'm sure this is a common problem and that *someone* has written it before. If I can avoid rewriting it, that'd be preferable. Best, Brandon