Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37204 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38303 invoked from network); 23 Apr 2008 14:04:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Apr 2008 14:04:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=jared.williams1@ntlworld.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=jared.williams1@ntlworld.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ntlworld.com designates 81.103.221.48 as permitted sender) X-PHP-List-Original-Sender: jared.williams1@ntlworld.com X-Host-Fingerprint: 81.103.221.48 mtaout02-winn.ispmail.ntl.com Solaris 10 (beta) Received: from [81.103.221.48] ([81.103.221.48:23249] helo=mtaout02-winn.ispmail.ntl.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FD/20-36942-DF14F084 for ; Wed, 23 Apr 2008 10:04:46 -0400 Received: from aamtaout02-winn.ispmail.ntl.com ([81.103.221.35]) by mtaout02-winn.ispmail.ntl.com with ESMTP id <20080423140802.KOVU17818.mtaout02-winn.ispmail.ntl.com@aamtaout02-winn.ispmail.ntl.com>; Wed, 23 Apr 2008 15:08:02 +0100 Received: from p2 ([82.3.16.111]) by aamtaout02-winn.ispmail.ntl.com with ESMTP id <20080423140659.VBH17393.aamtaout02-winn.ispmail.ntl.com@p2>; Wed, 23 Apr 2008 15:06:59 +0100 To: "'Piotr Czachur'" , Date: Wed, 23 Apr 2008 15:04:39 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook, Build 11.0.5510 In-Reply-To: <299f97600804230435o6bbf8eb2l9ca760458b949dd6@mail.gmail.com> Thread-Index: AcilN97Ps1G8fTaeTGug8gO4K38cdwAEwvMg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.4133 Message-ID: <20080423140659.VBH17393.aamtaout02-winn.ispmail.ntl.com@p2> Subject: RE: [PHP-DEV] Unable to unit test code containing *_uploaded_file() From: jared.williams1@ntlworld.com ("Jared Williams") References: <299f97600804230435o6bbf8eb2l9ca760458b949dd6@mail.gmail.com> > -----Original Message----- > From: Piotr Czachur [mailto:zimnyx@gmail.com] > Sent: 23 April 2008 12:36 > To: internals@lists.php.net > Subject: [PHP-DEV] Unable to unit test code containing > *_uploaded_file() > > Hello! > > I use PHPUnit for unit testing of my application (but this > issue is independent of PHPUnit). Tests are run from command > line so it's not way (that I can imagine) to simulate file > upload, because app code uses is_uploaded_file() to check if > file was really uploaded. > In my opionion some functions for simulation of file upload > in command line script would be very handy for unit testing. > > What I mean is adding a function or a set of functions for > setting file upload, for example: > do_file_upload( upload_params, upload data). > > This function would be for use only in testing code, so there > would be no need to change existing application code to add > unit tests, and what's more important it would not leak to > security risk. > > Regards, > Piotr Czachur > As of 1.0.1, SimpleTest's WebTester can upload files, I believe. Jared