note 93967 deleted from features.commandline by sobak

From: Date: Thu, 01 Dec 2016 06:45:21 +0000
Subject: note 93967 deleted from features.commandline by sobak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-207812@lists.php.net to get a copy of this message
Note Submitter: ca at php dot spamtrak dot org ---- I append this to most of my PHP files, to allow command line unit testing of a class. It ensures that the unit test is only run if the script is run directly, and won't be triggered by an include from another CLI script. <?php if (!empty($argc) && strstr($argv[0], basename(__FILE__))) { $test = new TestClass(); $rv = $test->Test(); die("Test returned $rv\n"); } ?>

« previous php.notes (#207812) next »