jenkins-bot has submitted this change and it was merged.
Change subject: Skip PhpTagsRuntimeFirstInit hook tests if PHPTAGS_TEST is not
defined
......................................................................
Skip PhpTagsRuntimeFirstInit hook tests if PHPTAGS_TEST is not defined
Change-Id: I87833a07045f594cafc31249ad7c43f0d6507017
---
M .gitignore
M tests/phpunit/includes/RuntimeTest.php
2 files changed, 50 insertions(+), 0 deletions(-)
Approvals:
Pastakhov: Looks good to me, approved
jenkins-bot: Verified
diff --git a/.gitignore b/.gitignore
index 98b092a..afc53f9 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
*~
*.kate-swp
.*.swp
+.directory
diff --git a/tests/phpunit/includes/RuntimeTest.php
b/tests/phpunit/includes/RuntimeTest.php
index ee94154..3781157 100644
--- a/tests/phpunit/includes/RuntimeTest.php
+++ b/tests/phpunit/includes/RuntimeTest.php
@@ -3052,12 +3052,21 @@
public function testRun_constant_test() {
wfDebug( 'PHPTags: this message must be after PHPTags test
initialization. ' . __METHOD__ );
+ if ( !defined( 'PHPTAGS_TEST' ) ) {
+ wfDebug( 'PHPTags: constant PHPTAGS_TEST is not
defined, skip PhpTagsRuntimeFirstInit hook tests. ' . __METHOD__ );
+ return;
+ }
+
$this->assertEquals(
Runtime::runSource( 'echo PHPTAGS_TEST;' ),
array( 'Test' )
);
}
public function testRun_constant_test_banned() {
+ if ( !defined( 'PHPTAGS_TEST' ) ) {
+ return;
+ }
+
$result = Runtime::runSource( 'echo PHPTAGS_TEST_BANNED;',
array('Test ban') );
$exc1 = new \PhpTags\HookException( 'Sorry, you cannot use this
constant' );
@@ -3070,12 +3079,20 @@
$this->assertEquals( $result, array( (string)$exc1,
(string)$exc2, false ) );
}
public function testRun_constant_class_test() {
+ if ( !defined( 'PHPTAGS_TEST' ) ) {
+ return;
+ }
+
$this->assertEquals(
Runtime::runSource( 'echo
PHPTAGS_TEST_IN_CLASS;' ),
array( 'I am constant PHPTAGS_TEST_IN_CLASS' )
);
}
public function testRun_constant_class_banned_test() {
+ if ( !defined( 'PHPTAGS_TEST' ) ) {
+ return;
+ }
+
$result = Runtime::runSource( 'echo
PHPTAGS_TEST_IN_CLASS_BANNED;', array('Test ban') );
$exc1 = new \PhpTags\HookException( 'Sorry, you cannot use this
constant' );
@@ -3088,12 +3105,20 @@
$this->assertEquals( $result, array( (string)$exc1,
(string)$exc2, false ) );
}
public function testRun_object_constant_test() {
+ if ( !defined( 'PHPTAGS_TEST' ) ) {
+ return;
+ }
+
$this->assertEquals(
Runtime::runSource( 'echo
PhpTagsTest::OBJ_TEST;' ),
array( 'c_OBJ_TEST' )
);
}
public function testRun_object_constant_banned_test() {
+ if ( !defined( 'PHPTAGS_TEST' ) ) {
+ return;
+ }
+
$result = Runtime::runSource( 'echo
PhpTagsTest::OBJ_TEST_BANNED;', array('Test ban') );
$exc1 = new \PhpTags\HookException( 'Sorry, you cannot use this
object constant' );
@@ -3106,12 +3131,20 @@
$this->assertEquals( $result, array( (string)$exc1,
(string)$exc2, false ) );
}
public function testRun_function_test() {
+ if ( !defined( 'PHPTAGS_TEST' ) ) {
+ return;
+ }
+
$this->assertEquals(
Runtime::runSource( 'echo
PhpTagsTestfunction();' ),
array( 'f_phptagstestfunction' )
);
}
public function testRun_function_banned_test() {
+ if ( !defined( 'PHPTAGS_TEST' ) ) {
+ return;
+ }
+
$result = Runtime::runSource( 'echo
PhpTagsTestfunction_BANNED();', array('Test ban') );
$exc1 = new \PhpTags\HookException( 'Sorry, you cannot use this
function' );
@@ -3124,12 +3157,20 @@
$this->assertEquals( $result, array( (string)$exc1,
(string)$exc2, false ) );
}
public function testRun_object_method_test() {
+ if ( !defined( 'PHPTAGS_TEST' ) ) {
+ return;
+ }
+
$this->assertEquals(
Runtime::runSource( '$obj = new PhpTagsTest();
echo $obj->myMETHOD();' ),
array( 'm_mymethod' )
);
}
public function testRun_object_method_banned_test() {
+ if ( !defined( 'PHPTAGS_TEST' ) ) {
+ return;
+ }
+
$result = Runtime::runSource( '$obj = new PhpTagsTest(); echo
$obj->myMETHOD_BaNnEd();', array('Test ban') );
$exc1 = new \PhpTags\HookException( 'Sorry, you cannot use this
method' );
@@ -3142,12 +3183,20 @@
$this->assertEquals( $result, array( (string)$exc1,
(string)$exc2, false ) );
}
public function testRun_static_method_test() {
+ if ( !defined( 'PHPTAGS_TEST' ) ) {
+ return;
+ }
+
$this->assertEquals(
Runtime::runSource( 'echo
PhpTagsTest::mystaticMETHOD();' ),
array( 's_mystaticmethod' )
);
}
public function testRun_static_method_banned_test() {
+ if ( !defined( 'PHPTAGS_TEST' ) ) {
+ return;
+ }
+
$result = Runtime::runSource( 'echo
PhpTagsTest::mystaticMETHOD_BaNnEd();', array('Test ban') );
$exc1 = new \PhpTags\HookException( 'Sorry, you cannot use this
static method' );
--
To view, visit https://gerrit.wikimedia.org/r/246141
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I87833a07045f594cafc31249ad7c43f0d6507017
Gerrit-PatchSet: 2
Gerrit-Project: mediawiki/extensions/PhpTags
Gerrit-Branch: master
Gerrit-Owner: Pastakhov <[email protected]>
Gerrit-Reviewer: Pastakhov <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits