logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: White box testing: msg#00014

php.simpletest.general

Subject: Re: White box testing

Dagfinn Reiersøl wrote:
Jason Sweat wrote:
--- Dagfinn Reiersøl <reiersol-f/vm7P8qpiNhl2p70BpVqQ@xxxxxxxxxxxxxxxx> wrote:

  
If I really want to do this, I can probably live with something simpler, 
like this:

function include_whitebox($file) {
    $code = file_get_contents($file);
    $code = preg_replace('/(private|protected)/','public',$code);
    eval('?>'.$code.'<?php ');
}

include_whitebox('MyClass.php');
    

That regex could be over-zealous, I would at least do:
$code = preg_replace('/\b(private|protected)\b/i','public',$code);

If not add somekind of a look ahead assertion for whitespace, then a "$"
character or the word "function".

  
You're right. This was just a quick and dirty implementation to show the idea. I've never actually used it, and I'm not sure I need it.
P.S. It occurred to me that there is one specific situation in which I've missed the ability to test private or protected members: complex object construction. I might construct an object out of several other objects, and if it's complex enough the process could fail. The component objects are frequently in private variables with no need for accessors.


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
krysalis.sandbo...    web.zope.zwiki/...    gnome.apps.gnum...    xfree86.newbie/...    editors.vim/200...    mozilla.enigmai...    boot-loaders.gr...    network.vnc.ult...    redhat.release....    java.geronimo.u...    os.netbsd.devel...    horde.wicked/20...    linux.lsb.discu...    ietf.ips/2005-0...    alsa.devel/2002...    user-groups.lin...    package-managem...    debian.devel.da...    security.cyrus....    video.gstreamer...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation