X-Git-Url: http://secure.phpeclipse.com diff --git a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/PHPUnitView.java b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/PHPUnitView.java index 656610d..9f388dd 100644 --- a/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/PHPUnitView.java +++ b/net.sourceforge.phpeclipse.phpunit/src/net/sourceforge/phpeclipse/phpunit/PHPUnitView.java @@ -17,17 +17,11 @@ import org.eclipse.jface.action.Action; 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; /** @@ -77,14 +71,18 @@ public class PHPUnitView extends 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; + + } @@ -98,6 +96,8 @@ public class PHPUnitView extends ViewPart { //parent.setLayout(new FillLayout(SWT.VERTICAL)); + dialog = new FileDialog(parent.getShell()); + GridLayout gridLayout = new GridLayout(); gridLayout.numColumns = 1; @@ -121,7 +121,7 @@ public class PHPUnitView extends ViewPart { //build the settings composite //buildSettingsComposite(parent); - settingsInfoComposite = new SettingsInfoComposite(parent, SWT.NONE); + //settingsInfoComposite = new SettingsInfoComposite(parent, SWT.NONE); // startButton = new Button(parent, SWT.CENTER); @@ -192,7 +192,7 @@ public class PHPUnitView extends ViewPart { public void run() { - settingsInfoComposite.showFileDialog(); + testSuiteToRun = dialog.open(); } }; selectTestAction.setText("Select Test Suite"); @@ -214,9 +214,12 @@ public class PHPUnitView extends ViewPart { 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(); @@ -318,6 +321,7 @@ public class PHPUnitView extends ViewPart { BufferedWriter out = new BufferedWriter(new FileWriter(testFile)); out.write("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"); @@ -349,6 +347,12 @@ public class PHPUnitView extends ViewPart { 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(); @@ -408,10 +412,8 @@ public class PHPUnitView extends ViewPart { * @param testID */ public void handleCommand( - String command, - String testCount, - String testID) { - + String command, String[] args) { + if (command.equals("startAll")) { @@ -420,13 +422,21 @@ public class PHPUnitView extends ViewPart { } 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")) {