Click here to get back home

exit interrupts my unit test

 HomeNewsGroups | Search | About
 comp.lang.php    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
exit interrupts my unit test HappyCamper 06-25-2008
Posted by HappyCamper on June 25, 2008, 6:01 pm
Please log in for more thread options
I am trying to be a good boy and write a test for every method I'm
writing. However, exit() is of course interrupting my test as I want
all of my tests to be on one page. I can't just place it last as I
have more then a few exit()s.

Please don't recommend using some great open source unit testing
framework as I really want to write my own.

Does anyone have any ideas? Is there a way to bypass exit or keep it
confined to a scope or something?

Posted by HappyCamper on June 25, 2008, 6:16 pm
Please log in for more thread options
Duh, just used return rather then exit.

Posted by Jerry Stuckle on June 25, 2008, 6:22 pm
Please log in for more thread options
HappyCamper wrote:
> I am trying to be a good boy and write a test for every method I'm
> writing. However, exit() is of course interrupting my test as I want
> all of my tests to be on one page. I can't just place it last as I
> have more then a few exit()s.
>
> Please don't recommend using some great open source unit testing
> framework as I really want to write my own.
>
> Does anyone have any ideas? Is there a way to bypass exit or keep it
> confined to a scope or something?
>

Nope. exit() is doing exactly what it's supposed to do.

But why are you calling exit() so much? I seldom call it - most often
after a header() redirect. Otherwise I use conditionals to structure my
code.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================


Similar ThreadsPosted
Unit testing in PHP. May 11, 2005, 7:13 am
Unit testing with PHPUnit2 October 13, 2004, 12:35 pm
Survey of unit tested OS PHP applications November 28, 2007, 2:58 am
[OT] Survey: die vs. exit August 13, 2004, 1:40 am
exit not working August 29, 2006, 10:55 am
exit link url variable? October 9, 2006, 7:07 pm
releasing resources and exit; February 4, 2008, 7:17 am
1st process' exit code July 14, 2008, 11:10 am
TEST - please ignore -TEST November 15, 2006, 12:56 pm
programs taking too long to exit April 2, 2007, 10:48 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap