Skip to content

Commit

Permalink
Merge Bartlomiej Laczkowski PhpUnit testing PR (eclipse-che#5468)
Browse files Browse the repository at this point in the history
* Initial support for PHPUnit testing.

Signed-off-by: Bartlomiej Laczkowski <bartlomiej.l@zend.com>

* Added improvements for exceptions handling and presentation model.

Signed-off-by: Bartlomiej Laczkowski <bartlomiej.l@zend.com>

* Improved test results presentation model and tests execution rules.

Signed-off-by: Bartlomiej Laczkowski <bartlomiej.l@zend.com>

* Small fixup after merge with master.

Signed-off-by: Bartlomiej Laczkowski <bartlomiej.l@zend.com>

* Added combined printer file that conforms different PHPUnit versions.

Signed-off-by: Bartlomiej Laczkowski <bartlomiej.l@zend.com>

* Fixed possible NPE issue while opening PHPUnit test case source file.

Signed-off-by: Bartlomiej Laczkowski <bartlomiej.l@zend.com>

* Bump up PHPUnit plug-ins version to 5.12.0.

* Small fixup after merge with master.

Signed-off-by: Bartlomiej Laczkowski <bartlomiej.l@zend.com>

* Format code to be in line with Che code conventions.

Signed-off-by: Bartlomiej Laczkowski <bartlomiej.l@zend.com>

* Small fix, add debugId

Signed-off-by: Vitalii Parfonov <vparfonov@codenvy.com>
  • Loading branch information
vparfonov authored Jun 26, 2017
1 parent 7b15c1e commit 6f0b74e
Show file tree
Hide file tree
Showing 74 changed files with 4,522 additions and 130 deletions.
4 changes: 4 additions & 0 deletions assembly/assembly-ide-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,10 @@
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-testing-junit-ide</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-testing-phpunit-ide</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-testing-testng-ide</artifactId>
Expand Down
4 changes: 4 additions & 0 deletions assembly/assembly-wsagent-war/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-testing-junit-server</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-testing-phpunit-server</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-testing-testng-server</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import org.eclipse.che.api.testing.server.listener.OutputTestListener;
import org.eclipse.che.api.testing.shared.TestCase;
import org.eclipse.che.api.testing.shared.TestResult;
import org.eclipse.che.api.testing.shared.dto.TestResultDto;
import org.eclipse.che.api.testing.shared.dto.TestResultRootDto;
import org.eclipse.che.dto.server.DtoFactory;
import org.eclipse.che.plugin.testing.classpath.server.TestClasspathProvider;
import org.eclipse.che.plugin.testing.classpath.server.TestClasspathRegistry;
Expand Down Expand Up @@ -542,4 +544,16 @@ private TestResult run3xTestClasses(Class< ? >... classes) throws Exception {
dtoResult.setTestCases(testList);
return dtoResult;
}

@Override
public TestResultRootDto runTests(Map<String, String> testParameters) throws Exception {
// New API - Not supported yet
return null;
}

@Override
public List<TestResultDto> getTestResults(List<String> testResultsPath) {
// New API - Not supported yet
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
import org.eclipse.che.api.testing.server.listener.OutputTestListener;
import org.eclipse.che.api.testing.shared.TestCase;
import org.eclipse.che.api.testing.shared.TestResult;
import org.eclipse.che.api.testing.shared.dto.TestResultDto;
import org.eclipse.che.api.testing.shared.dto.TestResultRootDto;
import org.eclipse.che.dto.server.DtoFactory;
import org.eclipse.che.plugin.testing.classpath.server.TestClasspathProvider;
import org.eclipse.che.plugin.testing.classpath.server.TestClasspathRegistry;
Expand Down Expand Up @@ -350,4 +352,16 @@ private TestResult runTestClasses(String projectAbsolutePath, Class< ? >... clas
}
});
}

@Override
public TestResultRootDto runTests(Map<String, String> testParameters) throws Exception {
// New API - Not supported yet
return null;
}

@Override
public List<TestResultDto> getTestResults(List<String> testResultsPath) {
// New API - Not supported yet
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2012-2017 Codenvy, S.A.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/epl-v10.html
Contributors:
Rogue Wave Software, Inc. - initial API and implementation
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<artifactId>che-plugin-testing-phpunit</artifactId>
<groupId>org.eclipse.che.plugin</groupId>
<version>5.14.0-SNAPSHOT</version>
</parent>
<artifactId>che-plugin-testing-phpunit-ide</artifactId>
<name>Che Plugin :: PHP Testing :: PHPUnit IDE</name>
<dependencies>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-commons-gwt</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-ide-api</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-ide-app</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-testing-ide</artifactId>
</dependency>
<dependency>
<groupId>org.vectomatic</groupId>
<artifactId>lib-gwt-svg</artifactId>
</dependency>
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt-user</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.gwt.inject</groupId>
<artifactId>gin</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.java</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*******************************************************************************
* Copyright (c) 2016 Rogue Wave Software, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rogue Wave Software, Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.plugin.testing.phpunit.ide;

import org.eclipse.che.ide.api.extension.ExtensionGinModule;
import org.eclipse.che.plugin.testing.ide.TestAction;

import com.google.gwt.inject.client.AbstractGinModule;
import com.google.gwt.inject.client.multibindings.GinMultibinder;

/**
* PHPUnit Gin module.
*
* @author Bartlomiej Laczkowski
*/
@ExtensionGinModule
public class PHPUnitGinModule extends AbstractGinModule {
@Override
protected void configure() {
GinMultibinder.newSetBinder(binder(), TestAction.class).addBinding().to(PHPUnitTestActionGroup.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*******************************************************************************
* Copyright (c) 2016 Rogue Wave Software, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rogue Wave Software, Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.plugin.testing.phpunit.ide;

import org.eclipse.che.ide.api.action.Action;
import org.eclipse.che.ide.api.action.ActionManager;
import org.eclipse.che.ide.api.action.DefaultActionGroup;
import org.eclipse.che.ide.api.keybinding.KeyBindingAgent;
import org.eclipse.che.plugin.testing.ide.TestAction;
import org.eclipse.che.plugin.testing.phpunit.ide.action.PHPRunContainerTestAction;
import org.eclipse.che.plugin.testing.phpunit.ide.action.PHPRunScriptTestAction;
import org.eclipse.che.plugin.testing.phpunit.ide.action.PHPRunScriptTestEditorAction;

import com.google.inject.Inject;

/**
* PHPUnit test action implementation.
*
* @author Bartlomiej Laczkowski
*/
public class PHPUnitTestActionGroup implements TestAction {

private final Action runScriptTestAction;
private final Action runScriptTestEditorAction;
private final Action runContainerTestAction;

@Inject
public PHPUnitTestActionGroup(ActionManager actionManager,
PHPRunScriptTestAction runScriptTestAction,
PHPRunScriptTestEditorAction runScriptTestEditorAction,
PHPRunContainerTestAction runContainerTestAction,
KeyBindingAgent keyBinding) {
actionManager.registerAction("PHPRunScriptTestAction", runScriptTestAction);
actionManager.registerAction("PHPRunScriptTestEditorAction", runScriptTestEditorAction);
actionManager.registerAction("PHPRunContainerTestAction", runContainerTestAction);
this.runScriptTestAction = runScriptTestAction;
this.runScriptTestEditorAction = runScriptTestEditorAction;
this.runContainerTestAction = runContainerTestAction;
}

@Override
public void addMainMenuItems(DefaultActionGroup testMainMenu) {
testMainMenu.add(runScriptTestEditorAction);
testMainMenu.add(runContainerTestAction);
}

@Override
public void addContextMenuItems(DefaultActionGroup testContextMenu) {
testContextMenu.add(runScriptTestAction);
testContextMenu.add(runContainerTestAction);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*******************************************************************************
* Copyright (c) 2016 Rogue Wave Software, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rogue Wave Software, Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.plugin.testing.phpunit.ide;

import com.google.gwt.i18n.client.Messages;

/**
* Localization constants. Interface to represent the constants defined in resource bundle: 'PHPUnitTestLocalizationConstant.properties'.
*
* @author Bartlomiej Laczkowski
*/
public interface PHPUnitTestLocalizationConstant extends Messages {

@Key("action.runScript.title")
String actionRunScriptTitle();

@Key("action.runScript.description")
String actionRunScriptDescription();

@Key("action.runContainer.title")
String actionRunContainerTitle();

@Key("action.runContainer.description")
String actionRunContainerDescription();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*******************************************************************************
* Copyright (c) 2016 Rogue Wave Software, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Rogue Wave Software, Inc. - initial API and implementation
*******************************************************************************/
package org.eclipse.che.plugin.testing.phpunit.ide;

import org.vectomatic.dom.svg.ui.SVGResource;

import com.google.gwt.resources.client.ClientBundle;

/**
* PHPUnit ide part resources.
*
* @author Bartlomiej Laczkowski
*/
public interface PHPUnitTestResources extends ClientBundle {

@Source("org/eclipse/che/plugin/testing/phpunit/ide/svg/test.svg")
SVGResource testIcon();

}
Loading

0 comments on commit 6f0b74e

Please sign in to comment.