#!/usr/bin/env php * Copyright 2001-2012 Strangecode, LLC * * This file is part of The Strangecode Codebase. * * The Strangecode Codebase is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License as published by the * Free Software Foundation, either version 3 of the License, or (at your option) * any later version. * * The Strangecode Codebase is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * The Strangecode Codebase. If not, see . */ /* * Creates new test case file from specified class file. * * @access public * @param Only argument is path to file containing class. * @author Quinn Comendant * @since 01 Dec 2005 13:56:09 */ require_once 'PHPUnit/Skeleton.php'; $dir = dirname(__FILE__) . '/../lib'; if ($_SERVER['argc'] == 2 && file_exists($dir . '/' . $_SERVER['argv'][1])) { $file = $_SERVER['argv'][1]; echo 'Proccessing ' . realpath($dir . '/' . $file) . "\n"; } else { die('First argument or file not found: ' . $_SERVER['argv'][1] . "\n"); } preg_match('/([^\.]+)\..*$/i', $file, $match); $classname = $match[1]; $ps = new PHPUnit_Skeleton($classname, '../lib/' . $file); // Generate the test class. // Default settings will not include any parent class methods, but // will include private methods. $ps->createTestClass(); // Write the new test class to file. // By default, code to run the test will be included. $ps->writeTestClass(); // $dir_handle = opendir($dir); // while ($dir_handle && ($file = readdir($dir_handle)) !== false) { // if (!preg_match('/^\./', $file) && is_file($dir . '/' . $file)) { // echo 'Proccessing ' . realpath($dir . '/' . $file) . "\n"; // // preg_match('/([^\.]+)\..*$/i', $file, $match); // $classname = $match[1]; // // $ps = new PHPUnit_Skeleton($classname, '../lib/' . $file); // // // Generate the test class. // // Default settings will not include any parent class methods, but // // will include private methods. // $ps->createTestClass(); // // // Write the new test class to file. // // By default, code to run the test will be included. // $ps->writeTestClass(); // // } // }