import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
/**
private ProgressInfoComposite progressInfoComposite;
private ResultsInfoComposite resultsInfoComposite;
- private SettingsInfoComposite settingsInfoComposite; //TODO: move somewhere else, launcher, wizard or preferences.
-
+ //private SettingsInfoComposite settingsInfoComposite; //TODO: move somewhere else, launcher, wizard or preferences.
+ private FileDialog dialog;
+
+ private String testSuiteToRun = "";
public PHPUnitView() {
if(view == null)
view = this;
+
+
}
//parent.setLayout(new FillLayout(SWT.VERTICAL));
+ dialog = new FileDialog(parent.getShell());
+
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 1;
//build the settings composite
//buildSettingsComposite(parent);
- settingsInfoComposite = new SettingsInfoComposite(parent, SWT.NONE);
+ //settingsInfoComposite = new SettingsInfoComposite(parent, SWT.NONE);
// startButton = new Button(parent, SWT.CENTER);
public void run() {
- settingsInfoComposite.showFileDialog();
+ testSuiteToRun = dialog.open();
}
};
selectTestAction.setText("Select Test Suite");
public void run() {
- String testFile = settingsInfoComposite.getTestSuite();
+
try {
- startTests(testFile);
+ if(testSuiteToRun == null || testSuiteToRun == "")
+ return;
+
+ startTests(testSuiteToRun);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
BufferedWriter out = new BufferedWriter(new FileWriter(testFile));
out.write("<?php" + "\n");
+ out.write("ob_start();" + "\n");
out.write("$path = \"C:/Documents and Settings/Ali Echihabi/My Documents/workspace.eclipse2.1/PHPUnit/phpunit\";" + "\n");
out.write("include_once($path . \"/phpunit_test.php\");" + "\n");
out.write("include_once $path . \"/socketTestResult.php\";" + "\n");
out.write("$suite = new TestSuite();" + "\n");
out.write("$suite->addTest(new TestSuite(\"" + testSuiteName + "\"));" + "\n");
-
-
- //out.write("$suite->addTest(new TestSuite(\"MoreTesterTests\"));" + "\n");
- //out.write("$suite->addTest(new TestSuite(\"ManyFailingTests\"));" + "\n");
- //out.write("$suite->addTest(new TestSuite(\"AssertEqualsTests\"));" + "\n");
-
out.write("$result = new SocketTestResult();" + "\n");
out.write("$suite->run($result);" + "\n");
out.write("$result->report(); " + "\n");
out.write("" + "\n");
out.write("" + "\n");
+ out.write("$output = ob_get_contents();" + "\n");
+ out.write("$fileHandle = fopen('c:/tmp/phpOut.txt');" + "\n");
+ out.write("fclose($fileHandle);" + "\n");
+
+
+ out.write("ob_end();" + "\n");
out.write("?>" + "\n");
out.flush();
* @param testID
*/
public void handleCommand(
- String command,
- String testCount,
- String testID) {
-
+ String command, String[] args) {
+
if (command.equals("startAll")) {
} else if (command.equals("testSuiteStarted")) {
+ String testID = args[0];
+ String testCount = args[1];
+
//createNewTestSuite("TestSuiteName: " + testID, testID, new Integer(testCount).intValue());
TestSuite suite = new TestSuite("TestSuiteName: " + testID, testID, new Integer(testCount).intValue());
testPool.addTestSuite(suite);
} else if (command.equals("testStarted")) {
- testPool.addTest(new TestCase("TestName: " + testID, testID));
+ String testID = args[0];
+ String testCount = args[1];
+ String testName = args[2];
+ String parentTestSuiteName = args[3];
+
+ testPool.addTest(new TestCase(testID, testName, parentTestSuiteName));
} else if (command.equals("testFINISHED")) {
private String currentCommand;
private String currentTestCount;
private String currentTestID;
+ private String currentTestName;
+ private String currentTestParentTestSuiteName;
private void doAsyncRunnable(Runnable runnable) {
currentCommand = attributes.getValue("command");
currentTestCount = attributes.getValue("testCount");
currentTestID = attributes.getValue("testID");
+ currentTestName = attributes.getValue("testName");
+ currentTestParentTestSuiteName = attributes.getValue("parentTestSuiteName");
doAsyncRunnable(new Runnable() {
public void run() {
- view.handleCommand(currentCommand, currentTestCount, currentTestID);
+ //view.handleCommand(currentCommand, currentTestCount, currentTestID, );
+ view.handleCommand(currentCommand, new String[] {currentTestID, currentTestCount, currentTestName, currentTestParentTestSuiteName});
+
}
});