Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75125 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73219 invoked from network); 28 Jun 2014 18:40:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 28 Jun 2014 18:40:18 -0000 Authentication-Results: pb1.pair.com header.from=frederic.hardy@mageekbox.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=frederic.hardy@mageekbox.net; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain mageekbox.net from 217.70.183.195 cause and error) X-PHP-List-Original-Sender: frederic.hardy@mageekbox.net X-Host-Fingerprint: 217.70.183.195 relay3-d.mail.gandi.net Received: from [217.70.183.195] ([217.70.183.195:37322] helo=relay3-d.mail.gandi.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 31/30-04906-11C0FA35 for ; Sat, 28 Jun 2014 14:40:17 -0400 Received: from mfilter34-d.gandi.net (mfilter34-d.gandi.net [217.70.178.165]) by relay3-d.mail.gandi.net (Postfix) with ESMTP id 12F37A80BF; Sat, 28 Jun 2014 20:40:14 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at mfilter34-d.gandi.net Received: from relay3-d.mail.gandi.net ([217.70.183.195]) by mfilter34-d.gandi.net (mfilter34-d.gandi.net [10.0.15.180]) (amavisd-new, port 10024) with ESMTP id Rf5SmRx9MVsG; Sat, 28 Jun 2014 20:40:12 +0200 (CEST) X-Originating-IP: 88.165.65.48 Received: from [192.168.0.2] (arb69-1-88-165-65-48.fbx.proxad.net [88.165.65.48]) (Authenticated sender: frederic.hardy@mageekbox.net) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 02D3BA8075; Sat, 28 Jun 2014 20:40:11 +0200 (CEST) Content-Type: multipart/alternative; boundary="Apple-Mail=_E46807FF-2C56-450B-9F2C-3855BF49E75A" Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) In-Reply-To: <53AEC4F0.8040307@php.net> Date: Sat, 28 Jun 2014 20:40:11 +0200 Cc: internals@lists.php.net Message-ID: References: <53AEC4F0.8040307@php.net> To: Sebastian Bergmann X-Mailer: Apple Mail (2.1878.2) Subject: Re: [PHP-DEV] Revisiting Anonymous Classes From: frederic.hardy@mageekbox.net (=?iso-8859-1?Q?Fr=E9d=E9ric_Hardy?=) --Apple-Mail=_E46807FF-2C56-450B-9F2C-3855BF49E75A Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=windows-1252 Hello @internals, Le 28 juin 2014 =E0 15:36, Sebastian Bergmann a = =E9crit : > The question remains, though, where to put this code. Obviously > it belongs with the test suite. But how to name the test double > classes? Unique names are required to be able to have multiple > (differently configured) test doubles for the same original > class. Mocking tools (such as PHPUnit_MockObject, for instance) > use random names for their test double classes. Atoum[1] use the \mock namespace to name stub and mock class. So, if you want to create a mock of \vendor\project\bar, atoum generate = the class \mock\vendor\project\bar. Moreover, to create a mock, just do $mock =3D new = \mock\vendor\project\bar() in a test method and atoum generate = automatically the corresponding mock class code, thanks to its = autoloader. And an another namespace than \mock can be defined in the configuration = file or in the test class. But sure that anonymous class may be interesting=85 [1] http://atoum.org/atoum Best regards, Fred --=20 =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D Fr=E9d=E9ric Hardy : Directeur technique et fonctionnel agile CV : = http://blog.mageekbox.net/public/cv.frederic.hardy.pdf Blog : http://blog.mageekbox.net Twitter : http://twitter.com/mageekguy =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --Apple-Mail=_E46807FF-2C56-450B-9F2C-3855BF49E75A--