summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-05-05 12:59:33 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-05-05 12:59:33 +0200
commitaae098c24a2c588ff195427f3404b9d679fd9eba (patch)
tree35717e110aefbe60bb01d6ccd7090e67d576d17d /tests
parent5aa3525479a29ea0521db9050d3ef22e17729e94 (diff)
downloadnextcloud-server-aae098c24a2c588ff195427f3404b9d679fd9eba.tar.gz
nextcloud-server-aae098c24a2c588ff195427f3404b9d679fd9eba.zip
Check usage of != and == - refs #16054
Diffstat (limited to 'tests')
-rw-r--r--tests/data/app/code-checker/test-equal.php11
-rw-r--r--tests/data/app/code-checker/test-not-equal.php11
-rw-r--r--tests/lib/app/codechecker.php8
3 files changed, 28 insertions, 2 deletions
diff --git a/tests/data/app/code-checker/test-equal.php b/tests/data/app/code-checker/test-equal.php
new file mode 100644
index 00000000000..90543ba7258
--- /dev/null
+++ b/tests/data/app/code-checker/test-equal.php
@@ -0,0 +1,11 @@
+<?php
+
+/**
+ * Class BadClass - uses equal instead of identical operator
+ */
+class BadClass {
+ public function foo() {
+ if (true == false) {
+ }
+ }
+}
diff --git a/tests/data/app/code-checker/test-not-equal.php b/tests/data/app/code-checker/test-not-equal.php
new file mode 100644
index 00000000000..d9a8d1c25c6
--- /dev/null
+++ b/tests/data/app/code-checker/test-not-equal.php
@@ -0,0 +1,11 @@
+<?php
+
+/**
+ * Class BadClass - uses equal instead of identical operator
+ */
+class BadClass {
+ public function foo() {
+ if (true != false) {
+ }
+ }
+}
diff --git a/tests/lib/app/codechecker.php b/tests/lib/app/codechecker.php
index 64403fd0f23..5f4fe162c1d 100644
--- a/tests/lib/app/codechecker.php
+++ b/tests/lib/app/codechecker.php
@@ -9,12 +9,14 @@
namespace Test\App;
use OC;
+use Test\TestCase;
-class CodeChecker extends \Test\TestCase {
+class CodeChecker extends TestCase {
/**
* @dataProvider providesFilesToCheck
- * @param $expectedErrors
+ * @param $expectedErrorToken
+ * @param $expectedErrorCode
* @param $fileToVerify
*/
public function testFindInvalidUsage($expectedErrorToken, $expectedErrorCode, $fileToVerify) {
@@ -33,6 +35,8 @@ class CodeChecker extends \Test\TestCase {
['OC_App', 1002, 'test-static-call.php'],
['OC_API', 1003, 'test-const.php'],
['OC_AppConfig', 1004, 'test-new.php'],
+ ['==', 1005, 'test-equal.php'],
+ ['!=', 1005, 'test-not-equal.php'],
];
}
}