[Pkg-owncloud-commits] [owncloud] 73/122: add positive tests for operator in code checker
David Prévot
taffit at moszumanska.debian.org
Sat May 9 00:00:17 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch stable8
in repository owncloud.
commit 493844eda4ec955b0d12e5c84412b42ae1df3fe2
Author: Morris Jobke <hey at morrisjobke.de>
Date: Tue May 5 13:09:12 2015 +0200
add positive tests for operator in code checker
---
tests/data/app/code-checker/test-identical-operator.php | 13 +++++++++++++
tests/lib/app/codechecker.php | 17 +++++++++++++++++
2 files changed, 30 insertions(+)
diff --git a/tests/data/app/code-checker/test-identical-operator.php b/tests/data/app/code-checker/test-identical-operator.php
new file mode 100644
index 0000000..4c7641e
--- /dev/null
+++ b/tests/data/app/code-checker/test-identical-operator.php
@@ -0,0 +1,13 @@
+<?php
+
+/**
+ * Class GoodClass - uses identical operator
+ */
+class GoodClass {
+ public function foo() {
+ if (true === false) {
+ }
+ if (true !== false) {
+ }
+ }
+}
diff --git a/tests/lib/app/codechecker.php b/tests/lib/app/codechecker.php
index 5f4fe16..f45ee02 100644
--- a/tests/lib/app/codechecker.php
+++ b/tests/lib/app/codechecker.php
@@ -39,4 +39,21 @@ class CodeChecker extends TestCase {
['!=', 1005, 'test-not-equal.php'],
];
}
+
+ /**
+ * @dataProvider validFilesData
+ * @param $fileToVerify
+ */
+ public function testPassValidUsage($fileToVerify) {
+ $checker = new OC\App\CodeChecker();
+ $errors = $checker->analyseFile(OC::$SERVERROOT . "/tests/data/app/code-checker/$fileToVerify");
+
+ $this->assertEquals(0, count($errors));
+ }
+
+ public function validFilesData() {
+ return [
+ ['test-identical-operator.php'],
+ ];
+ }
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list