[Fusionforge-commits] FusionForge branch master updated. v6.1-175-gb51fb3b

Franck Villaume nerville at libremir.placard.fr.eu.org
Sun Jan 13 19:34:06 CET 2019


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "FusionForge".

The branch, master has been updated
       via  b51fb3b6891c4ec509131622bd48ccf2e95e4476 (commit)
       via  d9bbf071ba70ed0623c7001f4a3f2981a37c758d (commit)
       via  2216cc0c11ec6eed0c3f425520b5ec82f217b548 (commit)
       via  373a87af08dde35095725f3176c7a3d8471f4e9b (commit)
       via  ee86e04654b90c40fc76754f776d07c8627b6355 (commit)
      from  a8adc6ad1d6bd3ed5cdcb0b374a59ac75a363f0c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=b51fb3b6891c4ec509131622bd48ccf2e95e4476

commit b51fb3b6891c4ec509131622bd48ccf2e95e4476
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Jan 13 19:33:39 2019 +0100

    implement isTextPresent using https://github.com/giorgiosironi/phpunit-selenium/blob/b8c6494b977f79098e748343455f129af3fdb292/Tests/Selenium2TestCaseTest.php as example

diff --git a/tests/func/SeleniumForge.php b/tests/func/SeleniumForge.php
index 3214c87..3cc37e0 100644
--- a/tests/func/SeleniumForge.php
+++ b/tests/func/SeleniumForge.php
@@ -44,6 +44,40 @@
  * ALONE BASIS."
  */
 
+/**
+ *Copyright (c) 2010-2013, Sebastian Bergmann <sebastian at phpunit.de>.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   * Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in
+ *     the documentation and/or other materials provided with the
+ *     distribution.
+ *
+ *   * Neither the name of Sebastian Bergmann nor the names of his
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
 define('FORGE_ADMIN_USERNAME', 'admin');
 define('FORGE_ADMIN_PASSWORD', 'my_Admin7');
 define('FORGE_OTHER_PASSWORD', 'toto_Tata8');
@@ -528,6 +562,15 @@ class FForge_SeleniumTestCase extends PHPUnit_Extensions_Selenium2TestCase
 	function open($url) {
 		$this->url($url);
 	}
+
+	function isTextPresent($text) {
+		$elementArray = $this->execute(array(
+				'script' => 'return document.body;',
+				'args' => array(),
+			));
+		$element = $this->elementFromResponseValue($elementArray);
+		$this->assertRegExp("/$text/", $element->text());
+	}
 }
 
 // Local Variables:

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=d9bbf071ba70ed0623c7001f4a3f2981a37c758d

commit d9bbf071ba70ed0623c7001f4a3f2981a37c758d
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Jan 13 19:29:15 2019 +0100

    drop obsolete patch

diff --git a/tests/func_tests.sh b/tests/func_tests.sh
index 5f615e5..d639455 100755
--- a/tests/func_tests.sh
+++ b/tests/func_tests.sh
@@ -71,10 +71,10 @@ install_selenium() {
 	if [ -e /etc/debian_version ]; then
 		apt-get -y install wget firefox-esr net-tools
 		if grep -q ^8 /etc/debian_version; then
-		    apt-get -y install phpunit phpunit-selenium patch psmisc patch rsyslog
+		    apt-get -y install phpunit phpunit-selenium psmisc rsyslog
 		    apt-get -y install -t jessie-backports openjdk-8-jdk
 		else
-		    apt-get -y install php-curl unzip composer patch psmisc patch rsyslog default-jre
+		    apt-get -y install php-curl unzip composer psmisc rsyslog default-jre
 		    mkdir -p /usr/local/share/php
 		    pushd /usr/local/share/php
 		    composer --no-plugins --no-scripts require phpunit/phpunit
@@ -84,7 +84,7 @@ install_selenium() {
 	else
 		yum -y install wget firefox
 		yum install -y java-1.8.0-openjdk
-		yum --enablerepo=epel install -y php-phpunit-PHPUnit php-phpunit-PHPUnit-Selenium psmisc patch net-tools
+		yum --enablerepo=epel install -y php-phpunit-PHPUnit php-phpunit-PHPUnit-Selenium psmisc net-tools
 	fi
 
 	# Install selenium (no packaged version available)
@@ -114,23 +114,6 @@ install_selenium() {
 		echo $(hostname -i) $(hostname -f) $(hostname)>> /etc/hosts
 	fi
 	grep -q "^$(hostname -i).*$(forge_get_config scm_host)" /etc/hosts || sed -i -e "s/^$(hostname -i).*/& $(forge_get_config scm_host)/" /etc/hosts
-
-	# Fix screenshot default black background (/usr/share/{php,pear}) (fix available upstream)
-	if [ -e /usr/share/*/PHPUnit/Extensions/SeleniumTestCase.php ] ; then
-	    patch -N /usr/share/*/PHPUnit/Extensions/SeleniumTestCase.php <<'EOF' || true
---- /usr/share/php/PHPUnit/Extensions/SeleniumTestCase.php-dist	2014-02-10 19:48:34.000000000 +0000
-+++ /usr/share/php/PHPUnit/Extensions/SeleniumTestCase.php	2014-09-01 10:09:38.823051288 +0000
-@@ -1188,7 +1188,7 @@
-             !empty($this->screenshotUrl)) {
-             $filename = $this->getScreenshotPath() . $this->testId . '.png';
-
--            $this->drivers[0]->captureEntirePageScreenshot($filename);
-+            $this->drivers[0]->captureEntirePageScreenshot($filename, 'background=#CCFFDD');
-
-             return 'Screenshot: ' . $this->screenshotUrl . '/' .
-                    $this->testId . ".png\n";
-EOF
-	fi
 }
 
 # Mitigate testsuite timeouts, cf.

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=2216cc0c11ec6eed0c3f425520b5ec82f217b548

commit 2216cc0c11ec6eed0c3f425520b5ec82f217b548
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Jan 13 18:08:42 2019 +0100

    implement open in SeleniumForge class

diff --git a/tests/func/10_Site/loginTest.php b/tests/func/10_Site/loginTest.php
index f722451..595cb26 100644
--- a/tests/func/10_Site/loginTest.php
+++ b/tests/func/10_Site/loginTest.php
@@ -49,7 +49,7 @@ class LoginProcess extends FForge_SeleniumTestCase
 	function testLogin()
 	{
 		// Test with a normal login.
-		$this->url( ROOT );
+		$this->open( ROOT );
 		if (!$this->isTextPresent("Log In")) {
 			$this->logout();
 		}
@@ -71,16 +71,16 @@ class LoginProcess extends FForge_SeleniumTestCase
 		$this->clickAndWait("login");
 		$this->assertTrue($this->isTextPresent("Forge Admin"));
 		$this->assertTrue($this->isTextPresent("Log Out"));
-		$this->url( ROOT );
+		$this->open( ROOT );
 		$this->assertTrue($this->isTextPresent("Forge Admin"));
 		$this->assertTrue($this->isTextPresent("Log Out"));
 		$this->logout();
-		$this->url( ROOT );
+		$this->open( ROOT );
 		// Verify that logout is succesful
 		$this->assertTrue($this->isTextPresent("Log In"));
 
 		// Test with an empty password.
-		$this->url( ROOT );
+		$this->open( ROOT );
 		$this->clickAndWait("link=Log In");
 		$this->assertTrue($this->isTextPresent("Log In"));
 		$this->type("form_loginname", FORGE_ADMIN_USERNAME);
@@ -92,7 +92,7 @@ class LoginProcess extends FForge_SeleniumTestCase
 		$this->assertTrue($this->isTextPresent("Log In"));
 
 		// Test with a wrong password.
-		$this->url( ROOT );
+		$this->open( ROOT );
 		$this->clickAndWait("link=Log In");
 		$this->type("form_loginname", FORGE_ADMIN_USERNAME);
 		$this->type("form_pw", "awrongpassword");
@@ -114,7 +114,7 @@ class LoginProcess extends FForge_SeleniumTestCase
 		$this->clickAndWait("submit");
 
 		$this->logout();
-		$this->url( ROOT );
+		$this->open( ROOT );
 		$this->clickAndWait("link=Log In");
 		$this->type("form_loginname", FORGE_ADMIN_USERNAME);
 		$this->type("form_pw", FORGE_OTHER_PASSWORD);
@@ -139,7 +139,7 @@ class LoginProcess extends FForge_SeleniumTestCase
 		$this->clickAndWait("submit");
 
 		$this->logout();
-		$this->url( ROOT );
+		$this->open( ROOT );
 		$this->clickAndWait("link=Log In");
 		$this->type("form_loginname", FORGE_ADMIN_USERNAME);
 		$this->type("form_pw", FORGE_ADMIN_PASSWORD);
@@ -148,7 +148,7 @@ class LoginProcess extends FForge_SeleniumTestCase
 		$this->assertTrue($this->isTextPresent("Log Out"));
 
 		// Test session expiration
-		$this->url( ROOT );
+		$this->open( ROOT );
 		if (!$this->isTextPresent("Log In")) {
 			$this->logout();
 		}
@@ -158,24 +158,24 @@ class LoginProcess extends FForge_SeleniumTestCase
 		$this->clickAndWait("login");
 		$this->assertTrue($this->isTextPresent("Forge Admin"));
 		$this->assertTrue($this->isTextPresent("Log Out"));
-		$this->url( ROOT );
+		$this->open( ROOT );
 		$this->assertTrue($this->isTextPresent("Forge Admin"));
 		$this->assertTrue($this->isTextPresent("Log Out"));
 		// Shorten session validity delay
 		$this->changeConfig(array("core" => array("session_expire" => "10")));
 		// Ensure session cookie is refreshed
 		sleep(5);
-		$this->url( ROOT );
+		$this->open( ROOT );
 		sleep(5);
-		$this->url( ROOT );
+		$this->open( ROOT );
 		sleep(5);
-		$this->url( ROOT );
+		$this->open( ROOT );
 		sleep(5);
 		$this->assertTrue($this->isTextPresent("Forge Admin"));
 		$this->assertTrue($this->isTextPresent("Log Out"));
 		// Now ensure that the session expires
 		sleep(15);
-		$this->url( ROOT );
+		$this->open( ROOT );
 		$this->assertFalse($this->isTextPresent("Forge Admin"));
 		$this->assertFalse($this->isTextPresent("Log Out"));
 	}
diff --git a/tests/func/SeleniumForge.php b/tests/func/SeleniumForge.php
index 88343d4..3214c87 100644
--- a/tests/func/SeleniumForge.php
+++ b/tests/func/SeleniumForge.php
@@ -520,6 +520,14 @@ class FForge_SeleniumTestCase extends PHPUnit_Extensions_Selenium2TestCase
 			$this->skip_test($msg);
 		}
 	}
+
+	/**
+	 * add PHP wrappers for SeleniumTestCase compatibility
+	 */
+
+	function open($url) {
+		$this->url($url);
+	}
 }
 
 // Local Variables:

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=373a87af08dde35095725f3176c7a3d8471f4e9b

commit 373a87af08dde35095725f3176c7a3d8471f4e9b
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Jan 13 17:59:33 2019 +0100

    coding style

diff --git a/tests/func/SeleniumForge.php b/tests/func/SeleniumForge.php
index 832ec0f..88343d4 100644
--- a/tests/func/SeleniumForge.php
+++ b/tests/func/SeleniumForge.php
@@ -156,14 +156,12 @@ class FForge_SeleniumTestCase extends PHPUnit_Extensions_Selenium2TestCase
 		}
 	}
 
-	public function clickAndWait($link)
-	{
+	public function clickAndWait($link) {
 		$this->click($link);
 		$this->waitForPageToLoad();
 	}
 
-	public function waitForTextPresent($text)
-	{
+	public function waitForTextPresent($text) {
 		for ($second = 0; ; $second++) {
 			if ($second >= 30) $this->fail("timeout");
 			try {
@@ -173,8 +171,7 @@ class FForge_SeleniumTestCase extends PHPUnit_Extensions_Selenium2TestCase
 		}
 	}
 
-	public function runCommand($cmd)
-	{
+	public function runCommand($cmd) {
 		system($cmd, $ret);
 		$this->assertEquals(0, $ret);
 		ob_flush();
@@ -195,21 +192,18 @@ class FForge_SeleniumTestCase extends PHPUnit_Extensions_Selenium2TestCase
 		ob_flush();
 	}
 
-	public function cron($cmd)
-	{
+	public function cron($cmd) {
 		$this->runCommand("forge_run_job $cmd");
 	}
 
-	public function cron_for_plugin($cmd, $plugin)
-	{
+	public function cron_for_plugin($cmd, $plugin) {
 		$this->runCommand("forge_run_plugin_job $plugin $cmd");
 	}
 
-    /**
-     * Execute pending system tasks
-     */
-	public function waitSystasks()
-	{
+	/**
+	 * Execute pending system tasks
+	 */
+	public function waitSystasks() {
 		$this->runCommand(dirname(__FILE__).'/../../src/bin/systasks_wait_until_empty.php');
 	}
 
@@ -217,8 +211,7 @@ class FForge_SeleniumTestCase extends PHPUnit_Extensions_Selenium2TestCase
 		$this->createAndGoto('ProjectA');
 	}
 
-	public function populateStandardTemplate($what='all')
-	{
+	public function populateStandardTemplate($what='all') {
 		if ($what == 'all') {
 			$what = array('trackers','tasks','forums');
 		} elseif ($what == 'empty') {
@@ -326,8 +319,7 @@ class FForge_SeleniumTestCase extends PHPUnit_Extensions_Selenium2TestCase
 		}
 	}
 
-	public function login($username)
-	{
+	public function login($username) {
 		$this->open( ROOT );
 		if ($this->isTextPresent('Log Out')) {
 			$this->logout();
@@ -336,8 +328,7 @@ class FForge_SeleniumTestCase extends PHPUnit_Extensions_Selenium2TestCase
 		$this->triggeredLogin($username);
 	}
 
-	public function triggeredLogin($username)
-	{
+	public function triggeredLogin($username) {
 		if ($username == FORGE_ADMIN_USERNAME) {
 			$password = FORGE_ADMIN_PASSWORD;
 		} else {
@@ -351,8 +342,7 @@ class FForge_SeleniumTestCase extends PHPUnit_Extensions_Selenium2TestCase
 		$this->logged_in = $username ;
 	}
 
-	public function logout()
-	{
+	public function logout() {
 //		$this->click("link=Log Out");
 		$this->open( ROOT ."/account/logout.php" );
 		$this->waitForPageToLoad();
@@ -360,21 +350,18 @@ class FForge_SeleniumTestCase extends PHPUnit_Extensions_Selenium2TestCase
 		$this->logged_in = false ;
 	}
 
-	public function switchUser($username)
-	{
+	public function switchUser($username) {
 		if ($this->logged_in != $username) {
 			$this->logout();
 			$this->login($username);
 		}
 	}
 
-	public function isLoginRequired()
-	{
+	public function isLoginRequired() {
 		return $this->isTextPresent("You've been redirected to this login page") ;
 	}
 
-	public function isPermissionDenied()
-	{
+	public function isPermissionDenied() {
 		return $this->isTextPresent("Permission denied") ;
 	}
 
@@ -431,8 +418,7 @@ class FForge_SeleniumTestCase extends PHPUnit_Extensions_Selenium2TestCase
 		$this->gotoProject($project);
 	}
 
-	public function createUser ($login)
-	{
+	public function createUser ($login) {
 		$this->switchUser(FORGE_ADMIN_USERNAME);
 		$this->open( ROOT );
 		$this->clickAndWait("link=Site Admin");

https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=ee86e04654b90c40fc76754f776d07c8627b6355

commit ee86e04654b90c40fc76754f776d07c8627b6355
Author: Franck Villaume <franck.villaume at trivialdev.com>
Date:   Sun Jan 13 17:54:23 2019 +0100

    add missing licence & tabs

diff --git a/tests/code_and_unit_tests.php b/tests/code_and_unit_tests.php
index 82175f9..6385b88 100644
--- a/tests/code_and_unit_tests.php
+++ b/tests/code_and_unit_tests.php
@@ -1,4 +1,23 @@
 <?php
+/**
+ * Copyright FusionForge Team
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge 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 2 of the License,
+ * or (at your option) any later version.
+ *
+ * FusionForge 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
 if (!defined('PHPUnit_MAIN_METHOD')) {
 	define('PHPUnit_MAIN_METHOD', 'AllTests::main');
 }
@@ -11,15 +30,12 @@ if (!@include_once 'PHPUnit/Autoload.php') {
 @include_once 'PHP/Token/Stream/Autoload.php';
 @include_once 'Text/Template/Autoload.php';
 
-class AllTests
-{
-	public static function main()
-	{
-        PHPUnit_TextUI_TestRunner::run(self::suite());
+class AllTests {
+	public static function main() {
+		PHPUnit_TextUI_TestRunner::run(self::suite());
 	}
 
-	public static function suite()
-	{
+	public static function suite() {
 		$suite = new PHPUnit_Framework_TestSuite('PHPUnit');
 
 		// Unit tests
diff --git a/tests/func_tests.php b/tests/func_tests.php
index 45c1c3c..2c7211a 100644
--- a/tests/func_tests.php
+++ b/tests/func_tests.php
@@ -1,4 +1,24 @@
 <?php
+/**
+ * Copyright FusionForge Team
+ *
+ * This file is part of FusionForge.
+ *
+ * FusionForge 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 2 of the License,
+ * or (at your option) any later version.
+ *
+ * FusionForge 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 this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
 if (!defined('PHPUnit_MAIN_METHOD')) {
 	define('PHPUnit_MAIN_METHOD', 'AllTests::main');
 }
@@ -15,22 +35,20 @@ if (@include_once '/usr/local/share/php/vendor/autoload.php') {
 	}
 }
 
-class AllTests
-{
-	public static function main()
-	{
-        PHPUnit_TextUI_TestRunner::run(self::suite());
+class AllTests {
+	public static function main() {
+		PHPUnit_TextUI_TestRunner::run(self::suite());
 	}
 
-	public static function suite()
-	{
+	public static function suite() {
 		$suite = new PHPUnit_Framework_TestSuite('PHPUnit');
 
 		// Selenium tests
-		if (getenv('TESTGLOB') != FALSE)
+		if (getenv('TESTGLOB') != FALSE) {
 			$files = glob(dirname(__FILE__).'/'.getenv('TESTGLOB'));
-		else
+		} else {
 			$files = glob(dirname(__FILE__).'/func/*/*Test.php');
+		}
 		natsort($files);
 		$suite->addTestFiles($files);
 

-----------------------------------------------------------------------

Summary of changes:
 tests/code_and_unit_tests.php    | 30 +++++++++---
 tests/func/10_Site/loginTest.php | 26 +++++------
 tests/func/SeleniumForge.php     | 99 +++++++++++++++++++++++++++-------------
 tests/func_tests.php             | 36 +++++++++++----
 tests/func_tests.sh              | 23 ++--------
 5 files changed, 134 insertions(+), 80 deletions(-)


hooks/post-receive
-- 
FusionForge



More information about the Fusionforge-commits mailing list