Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-01-29 00:08:50 +0300
committerThomas Müller <thomas.mueller@tmit.eu>2015-02-10 13:51:24 +0300
commitd74662df7df72ad9ec238b78223acc0e7f65311f (patch)
treeffadb56b1bb0c0dfa11cb54a10a67186aff31306 /tests/data
parent5ae03fd650b6f3665d1c69ead674d4f5d6420513 (diff)
implement php code checker to detect usage of not allowed private APIs - including console command to check local code to be used by developers
Diffstat (limited to 'tests/data')
-rw-r--r--tests/data/app/code-checker/test-const.php10
-rw-r--r--tests/data/app/code-checker/test-extends.php8
-rw-r--r--tests/data/app/code-checker/test-implements.php9
-rw-r--r--tests/data/app/code-checker/test-new.php10
-rw-r--r--tests/data/app/code-checker/test-static-call.php10
5 files changed, 47 insertions, 0 deletions
diff --git a/tests/data/app/code-checker/test-const.php b/tests/data/app/code-checker/test-const.php
new file mode 100644
index 00000000000..2af6baf2f3d
--- /dev/null
+++ b/tests/data/app/code-checker/test-const.php
@@ -0,0 +1,10 @@
+<?php
+
+/**
+ * Class BadClass - accessing consts on blacklisted classes is not allowed
+ */
+class BadClass {
+ public function foo() {
+ $bar = OC_API::ADMIN_AUTH;
+ }
+}
diff --git a/tests/data/app/code-checker/test-extends.php b/tests/data/app/code-checker/test-extends.php
new file mode 100644
index 00000000000..39d29da92dc
--- /dev/null
+++ b/tests/data/app/code-checker/test-extends.php
@@ -0,0 +1,8 @@
+<?php
+
+/**
+ * Class BadClass - sub class a forbidden class is not allowed
+ */
+class BadClass extends OC_Hook {
+
+}
diff --git a/tests/data/app/code-checker/test-implements.php b/tests/data/app/code-checker/test-implements.php
new file mode 100644
index 00000000000..3bf2f959b52
--- /dev/null
+++ b/tests/data/app/code-checker/test-implements.php
@@ -0,0 +1,9 @@
+<?php
+
+/**
+ * Class BadClass - sub class a forbidden class is not allowed
+ * NOTE: lowercase typo is intended
+ */
+class BadClass implements oC_Avatar {
+
+}
diff --git a/tests/data/app/code-checker/test-new.php b/tests/data/app/code-checker/test-new.php
new file mode 100644
index 00000000000..0522d473d96
--- /dev/null
+++ b/tests/data/app/code-checker/test-new.php
@@ -0,0 +1,10 @@
+<?php
+
+/**
+ * Class BadClass - creating an instance of a blacklisted class is not allowed
+ */
+class BadClass {
+ public function foo() {
+ $bar = new OC_AppConfig();
+ }
+}
diff --git a/tests/data/app/code-checker/test-static-call.php b/tests/data/app/code-checker/test-static-call.php
new file mode 100644
index 00000000000..4afe0b1174d
--- /dev/null
+++ b/tests/data/app/code-checker/test-static-call.php
@@ -0,0 +1,10 @@
+<?php
+
+/**
+ * Class BadClass - calling static methods on blacklisted classes is not allowed
+ */
+class BadClass {
+ public function foo() {
+ OC_App::isEnabled('bar');
+ }
+}