diff options
author | Simon L'nu <simon.lnu@gmail.com> | 2012-03-15 01:02:44 -0400 |
---|---|---|
committer | Simon L'nu <simon.lnu@gmail.com> | 2012-03-15 01:02:44 -0400 |
commit | 6e133e75c3ed12a4637d9cc946b1cb838619b9cc (patch) | |
tree | 44eb74a6943ecc26a795f136e79d653c39955d63 /tests/expand_acl_test.php | |
parent | ebccf13c4c883e1438f4446d6aeba070ce6ee967 (diff) | |
parent | b06c5983a4dae26dd24aecd7473bad98558cd6fc (diff) | |
download | volse-hubzilla-6e133e75c3ed12a4637d9cc946b1cb838619b9cc.tar.gz volse-hubzilla-6e133e75c3ed12a4637d9cc946b1cb838619b9cc.tar.bz2 volse-hubzilla-6e133e75c3ed12a4637d9cc946b1cb838619b9cc.zip |
Merge branch 'master', remote-tracking branch 'remotes/upstream/master'
* remotes/upstream/master:
don't allow multiple friends with http/https same person, don't show mail2 coming soon unless person is allowed to have email contacts
roll protocol version due to ssl_policy settings
force login to ssl on SSL_POLICY_SELFSIGN
basic ssl_policy for important modules
ssl_policy stuff
revup
splitted tests into several files
removed done TODO
get_tags tests corrected. They test for the right things now.
addon settings form error
more work on filer, comment level and file tag removal
added slack-NS, non-scrolly, slackr-based theme.
get tags test improved
splitted test cases.
changed a test string
added some tests
added library and include to .htaccess
excludes reports from git
better tests
added test blueprints, fixed? encoding issues
* master:
Diffstat (limited to 'tests/expand_acl_test.php')
-rwxr-xr-x | tests/expand_acl_test.php | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/tests/expand_acl_test.php b/tests/expand_acl_test.php new file mode 100755 index 000000000..b516a3f14 --- /dev/null +++ b/tests/expand_acl_test.php @@ -0,0 +1,142 @@ +<?php +/** + * this test tests the expand_acl function + * + * @package test.util + */ + +/** required, it is the file under test */ +require_once('include/text.php'); + +/**
+ * TestCase for the expand_acl function
+ *
+ * @author Alexander Kampmann
+ * @package test.util
+ */
+class ExpandAclTest extends PHPUnit_Framework_TestCase { + + /**
+ * test expand_acl, perfect input
+ */
+ public function testExpandAclNormal() {
+ $text='<1><2><3>';
+ $this->assertEquals(array(1, 2, 3), expand_acl($text));
+ }
+ + /** + * test with a big number + */
+ public function testExpandAclBigNumber() {
+ $text='<1><'.PHP_INT_MAX.'><15>';
+ $this->assertEquals(array(1, PHP_INT_MAX, 15), expand_acl($text));
+ }
+ + /** + * test with a string in it. + * + * TODO: is this valid input? Otherwise: should there be an exception? + */
+ public function testExpandAclString() {
+ $text="<1><279012><tt>";
+ $this->assertEquals(array(1, 279012, 'tt'), expand_acl($text));
+ }
+ + /** + * test with a ' ' in it. + * + * TODO: is this valid input? Otherwise: should there be an exception? + */
+ public function testExpandAclSpace() {
+ $text="<1><279 012><32>";
+ $this->assertEquals(array(1, "279 012", "32"), expand_acl($text));
+ }
+ + /** + * test empty input + */
+ public function testExpandAclEmpty() {
+ $text="";
+ $this->assertEquals(array(), expand_acl($text));
+ }
+ + /** + * test invalid input, no < at all + * + * TODO: should there be an exception? + */
+ public function testExpandAclNoBrackets() {
+ $text="According to documentation, that's invalid. "; //should be invalid
+ $this->assertEquals(array(), expand_acl($text));
+ }
+ + /**
+ * test invalid input, just open <
+ *
+ * TODO: should there be an exception?
+ */
+ public function testExpandAclJustOneBracket1() {
+ $text="<Another invalid string"; //should be invalid
+ $this->assertEquals(array(), expand_acl($text));
+ }
+ + /**
+ * test invalid input, just close >
+ *
+ * TODO: should there be an exception?
+ */
+ public function testExpandAclJustOneBracket2() {
+ $text="Another invalid> string"; //should be invalid
+ $this->assertEquals(array(), expand_acl($text));
+ }
+ + /**
+ * test invalid input, just close >
+ *
+ * TODO: should there be an exception?
+ */
+ public function testExpandAclCloseOnly() {
+ $text="Another> invalid> string>"; //should be invalid
+ $this->assertEquals(array(), expand_acl($text));
+ }
+ + /**
+ * test invalid input, just open <
+ *
+ * TODO: should there be an exception?
+ */
+ public function testExpandAclOpenOnly() {
+ $text="<Another< invalid string<"; //should be invalid
+ $this->assertEquals(array(), expand_acl($text));
+ }
+ + /**
+ * test invalid input, open and close do not match
+ *
+ * TODO: should there be an exception?
+ */
+ public function testExpandAclNoMatching1() {
+ $text="<Another<> invalid <string>"; //should be invalid
+ $this->assertEquals(array(), expand_acl($text));
+ }
+ + /**
+ * test invalid input, open and close do not match
+ *
+ * TODO: should there be an exception?
+ */
+ public function testExpandAclNoMatching2() {
+ $text="<1>2><3>";
+ $this->assertEquals(array(), expand_acl($text));
+ } + + /**
+ * test invalid input, empty <>
+ *
+ * TODO: should there be an exception? Or array(1, 3)
+ */
+ public function testExpandAclEmptyMatch() {
+ $text="<1><><3>";
+ $this->assertEquals(array(), expand_acl($text));
+ } +}
\ No newline at end of file |