From 5be9d5e0ee14d5f8469e770bdf32dbe60453de67 Mon Sep 17 00:00:00 2001 From: "marcimat@rezo.net" <marcimat@rezo.net@ac52e18a-acf5-0310-9fe8-c4428f23b10a> Date: Sun, 16 Feb 2014 17:24:47 +0000 Subject: [PATCH] =?UTF-8?q?Adaptation=20de=20quelques=20=C3=A9l=C3=A9ments?= =?UTF-8?q?=20pour=20simpletest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://zone.spip.org/spip-zone/_core_/tests@80771 ac52e18a-acf5-0310-9fe8-c4428f23b10a --- index.php | 38 ++++++++++---------- simpletest/inc/tests.php | 18 +++++----- simpletest/simpletest/autorun.php | 2 +- unit/simpletest/_spipTest/recuperer_code.php | 2 +- unit/simpletest/_spipTest/spipTest_tests.php | 1 + 5 files changed, 32 insertions(+), 29 deletions(-) diff --git a/index.php b/index.php index 9263b97d6f..5bb7fabeee 100644 --- a/index.php +++ b/index.php @@ -41,29 +41,29 @@ // utiliser le parametre $_GET['fichier'] pour limiter les tests a un seul fichier if (isset($_GET['fichier']) AND $_GET['fichier'] != '' AND preg_match('[^\d\w-.]', $_GET['fichier']) != 1) $fic = $_GET['fichier']; - - + + foreach ($tests as $test) { if (isset($fic) AND $fic != '' AND substr_count($test, $fic) == 0) continue; if (strlen($t=_request('rech')) && (strpos($test, $t)===false)) continue; - - //ignorer le contenu du jeu de squelettes dédié aux tests - if (stristr($test,'squelettes/')) - continue; - - //ignorer le contenu des donnees de test - if (stristr($test,'data/')) - continue; - - //ignorer les fichiers lanceurs pour simpleTests aux tests - if (stristr($test,'lanceur_spip.php')) - continue; - if (stristr($test,'all_tests.php')) - continue; - + + //ignorer le contenu du jeu de squelettes dédié aux tests + if (stristr($test,'squelettes/')) + continue; + + //ignorer le contenu des donnees de test + if (stristr($test,'data/')) + continue; + + //ignorer les fichiers lanceurs pour simpleTests aux tests + if (stristr($test,'lanceur_spip.php')) + continue; + if (stristr($test,'all_tests.php')) + continue; + if (strncmp(basename($test),'inclus_',7)!==0 AND substr(basename($test),-14) != '_fonctions.php' AND (strncmp(basename($test),'NA_',3)!==0 OR _request('var_mode')=='dev')){ @@ -98,7 +98,7 @@ } } } - + echo "</dl>\n"; echo "<div id='count'>"; @@ -116,7 +116,7 @@ function version_spip() { $version = $GLOBALS['spip_version_affichee']; if ($svn_revision = version_svn_courante(_DIR_RACINE)) $version .= ' ' . (($svn_revision < 0) ? 'SVN ':'') - . "[<a href='http://trac.rezo.net/trac/spip/changeset/" + . "[<a href='http://core.spip.org/projects/spip/repository/revisions/" . abs($svn_revision) . "' onclick=\"window.open(this.href); return false;\">" . abs($svn_revision) . "</a>]"; diff --git a/simpletest/inc/tests.php b/simpletest/inc/tests.php index 7d5a56b7f3..85ee3bb9a2 100644 --- a/simpletest/inc/tests.php +++ b/simpletest/inc/tests.php @@ -1,10 +1,12 @@ <?php + include_spip('simpletest/autorun'); include_spip('inc/autoriser'); -if (!autoriser('configurer')) +if (!autoriser('configurer')) { die('Administrateur requis !'); +} if (isset($GLOBALS['visiteur_session']['statut']) AND $GLOBALS['visiteur_session']['statut'] != '0minirezo' @@ -467,7 +469,7 @@ class SpipHtmlReporter extends HtmlReporter { private $_na; private $character_set; - function __construct($charset='UTF-8') { + public function __construct($charset='UTF-8') { chdir(_CHDIR); parent::__construct($charset); $this->_na = 0; @@ -477,8 +479,8 @@ class SpipHtmlReporter extends HtmlReporter { * retourne un code css de deco * */ - function _getCss() { - $css = parent::_getCss(); + protected function getCss() { + $css = parent::getCss(); return $css . "\n.na{background-color: inherit; color: #fa0;}" . "\n.complements{background-color: inherit; color: #999;}"; } @@ -498,7 +500,7 @@ class SpipHtmlReporter extends HtmlReporter { print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=" . $this->character_set . "\">\n"; print "<style type=\"text/css\">\n"; - print $this->_getCss() . "\n"; + print $this->getCss() . "\n"; print "</style>\n"; print "<link rel='stylesheet' href='" . url_absolue(find_in_path('tests.css')) . "' type='text/css' />"; print "</head>\n<body>\n"; @@ -571,7 +573,7 @@ class SpipHtmlReporter extends HtmlReporter { array_shift($breadcrumb); print implode(" -> ", $breadcrumb); $message = $exception->getMessage(); - print " -> <strong>" . $this->_htmlEntities($message) . "</strong><br />\n"; + print " -> <strong>" . $this->_htmlEntities($message) . "</strong><br />\n"; } /** @@ -629,7 +631,7 @@ class SpipHtmlReporter extends HtmlReporter { $version = $GLOBALS['spip_version_affichee']; if ($svn_revision = version_svn_courante(_DIR_RACINE)) { $version .= ' ' . (($svn_revision < 0) ? 'SVN ':'') - . "[<a href='http://trac.rezo.net/trac/spip/changeset/" + . "[<a href='http://core.spip.org/projects/spip/repository/revisions/" . abs($svn_revision) . "' onclick=\"window.open(this.href); return false;\">" . abs($svn_revision) . "</a>]"; } @@ -792,7 +794,7 @@ class SqueletteTest{ <body class="page_test"> ' . $this->body . ' </body> - </html> + </html> '; return $code; } diff --git a/simpletest/simpletest/autorun.php b/simpletest/simpletest/autorun.php index 17ad7a39ed..5cb1a32aee 100644 --- a/simpletest/simpletest/autorun.php +++ b/simpletest/simpletest/autorun.php @@ -96,4 +96,4 @@ function capture_new_classes() { $SIMPLETEST_AUTORUNNER_INITIAL_CLASSES ? $SIMPLETEST_AUTORUNNER_INITIAL_CLASSES : array())); } -?> \ No newline at end of file +?> diff --git a/unit/simpletest/_spipTest/recuperer_code.php b/unit/simpletest/_spipTest/recuperer_code.php index f9bef20066..8d79f4af26 100644 --- a/unit/simpletest/_spipTest/recuperer_code.php +++ b/unit/simpletest/_spipTest/recuperer_code.php @@ -2,7 +2,7 @@ require_once('lanceur_spip.php'); class Test_SpipTestRecupererCode extends SpipTest{ - + function testRecupererFond(){ $this->assertEqual('Hello World', recuperer_fond('tests/core/inc/inclus_hello_world')); } diff --git a/unit/simpletest/_spipTest/spipTest_tests.php b/unit/simpletest/_spipTest/spipTest_tests.php index c390c2749f..7b5eda17dd 100644 --- a/unit/simpletest/_spipTest/spipTest_tests.php +++ b/unit/simpletest/_spipTest/spipTest_tests.php @@ -1,6 +1,7 @@ <?php require_once('lanceur_spip.php'); + class Test_SpipTest extends SpipTest{ function testAssertOk(){ -- GitLab