diff options
author | Simon L'nu <simon.lnu@gmail.com> | 2012-04-07 14:47:02 -0400 |
---|---|---|
committer | Simon L'nu <simon.lnu@gmail.com> | 2012-04-07 14:47:02 -0400 |
commit | cee36087470acbc4aeff121ab91cd337737dcc67 (patch) | |
tree | a093294b2b3ee2f99c0dc5b95d5844bf9817eafa /tests | |
parent | bc69a957dc875b699240827cb4af2691f8a8fcd6 (diff) | |
parent | f931d5c918fa3146afa851a4f32c90a35ee1c85b (diff) | |
download | volse-hubzilla-cee36087470acbc4aeff121ab91cd337737dcc67.tar.gz volse-hubzilla-cee36087470acbc4aeff121ab91cd337737dcc67.tar.bz2 volse-hubzilla-cee36087470acbc4aeff121ab91cd337737dcc67.zip |
Merge branch 'master', remote-tracking branch 'remotes/upstream/master'
* remotes/upstream/master:
diabook-themes: small fix
changelog 1.014 : image-rezise via jquery-plugin in stream comments under uploaded pictues add Diabook's version-number in head-section
ignore utf8 offset error for unit tests
had arg order backwards
try assertContains
tag tests cont.
fix autonamenegativelength test
some work on tests
* master:
Diffstat (limited to 'tests')
-rw-r--r-- | tests/autoname_test.php | 4 | ||||
-rw-r--r-- | tests/expand_acl_test.php | 14 | ||||
-rw-r--r-- | tests/get_tags_test.php | 37 |
3 files changed, 37 insertions, 18 deletions
diff --git a/tests/autoname_test.php b/tests/autoname_test.php index 9dae920ca..c83e4a471 100644 --- a/tests/autoname_test.php +++ b/tests/autoname_test.php @@ -40,7 +40,7 @@ class AutonameTest extends PHPUnit_Framework_TestCase { */
public function testAutonameNoLength() {
$autoname1=autoname(0);
- $this->assertEquals(0, count($autoname1));
+ $this->assertEquals(0, strlen($autoname1));
}
/** @@ -50,7 +50,7 @@ class AutonameTest extends PHPUnit_Framework_TestCase { */
public function testAutonameNegativeLength() {
$autoname1=autoname(-23);
- $this->assertEquals(0, count($autoname1));
+ $this->assertEquals(0, strlen($autoname1));
}
// public function testAutonameMaxLength() {
diff --git a/tests/expand_acl_test.php b/tests/expand_acl_test.php index b516a3f14..154bc921d 100644 --- a/tests/expand_acl_test.php +++ b/tests/expand_acl_test.php @@ -39,7 +39,7 @@ class ExpandAclTest extends PHPUnit_Framework_TestCase { */
public function testExpandAclString() {
$text="<1><279012><tt>";
- $this->assertEquals(array(1, 279012, 'tt'), expand_acl($text));
+ $this->assertEquals(array(1, 279012), expand_acl($text));
}
/** @@ -49,7 +49,7 @@ class ExpandAclTest extends PHPUnit_Framework_TestCase { */
public function testExpandAclSpace() {
$text="<1><279 012><32>";
- $this->assertEquals(array(1, "279 012", "32"), expand_acl($text));
+ $this->assertEquals(array(1, "279", "32"), expand_acl($text));
}
/** @@ -127,16 +127,22 @@ class ExpandAclTest extends PHPUnit_Framework_TestCase { */
public function testExpandAclNoMatching2() {
$text="<1>2><3>";
- $this->assertEquals(array(), expand_acl($text));
+// The angles are delimiters which aren't important +// the important thing is the numeric content, this returns array(1,2,3) currently +// we may wish to eliminate 2 from the results, though it isn't harmful +// It would be a better test to figure out if there is any ACL input which can +// produce this $text and fix that instead. +// $this->assertEquals(array(), expand_acl($text));
} /**
* test invalid input, empty <>
*
* TODO: should there be an exception? Or array(1, 3)
+ * (This should be array(1,3) - mike) */
public function testExpandAclEmptyMatch() {
$text="<1><><3>";
- $this->assertEquals(array(), expand_acl($text));
+ $this->assertEquals(array(1,3), expand_acl($text));
} }
\ No newline at end of file diff --git a/tests/get_tags_test.php b/tests/get_tags_test.php index 9051923be..e5c6485de 100644 --- a/tests/get_tags_test.php +++ b/tests/get_tags_test.php @@ -139,23 +139,35 @@ class GetTagsTest extends PHPUnit_Framework_TestCase { $str_tags='';
handle_tag($this->a, $text, $inform, $str_tags, 11, $tags[0]);
- $this->assertEquals("cid:15", $inform); - $this->assertEquals("@[url=http://justatest.de]Mike Lastname[/url]", $str_tags); - $this->assertEquals("hi @[url=http://justatest.de]Mike Lastname[/url].because", $text);
+ // (mike) - This is a tricky case. + // we support mentions as in @mike@example.com - which contains a period. + // This shouldn't match anything unless you have a contact named "Mike.because". + // We may need another test for "@Mike. because" - which should return the contact + // as we ignore trailing periods in tags. + +// $this->assertEquals("cid:15", $inform); +// $this->assertEquals("@[url=http://justatest.de]Mike Lastname[/url]", $str_tags); +// $this->assertEquals("hi @[url=http://justatest.de]Mike Lastname[/url].because", $text);
+ + $this->assertEquals("", $inform); + $this->assertEquals("", $str_tags); + } /**
* test with two Person tags. * There's a minor spelling mistake...
*/
+ public function testGetTagsPerson2Spelling() {
$text="hi @Mike@campino@friendica.eu";
$tags=get_tags($text);
- - $this->assertEquals(2, count($tags));
- $this->assertTrue(in_array("@Mike", $tags)); - $this->assertTrue(in_array("@campino@friendica.eu", $tags));
+ +// This construct is not supported. Results are indeterminate +// $this->assertEquals(2, count($tags));
+// $this->assertTrue(in_array("@Mike", $tags)); +// $this->assertTrue(in_array("@campino@friendica.eu", $tags));
}
/** @@ -251,7 +263,8 @@ class GetTagsTest extends PHPUnit_Framework_TestCase { $this->assertEquals("Test with @[url=http://justatest.de]Mike Lastname[/url] id tag", $text);
$this->assertEquals("@[url=http://justatest.de]Mike Lastname[/url]", $str_tags);
- $this->assertEquals("cid:15", $inform); + // this test may produce two cid:15 entries - which is OK because duplicates are pruned before delivery + $this->assertContains("cid:15",$inform); } /** @@ -297,10 +310,10 @@ class GetTagsTest extends PHPUnit_Framework_TestCase { $this->assertTrue(in_array("#nice", $tags));
$this->assertTrue(in_array("@first_last", $tags)); - //right now, none of the is matched - $this->assertFalse(in_array("@Mike@campino@friendica.eu", $tags));
- $this->assertTrue(in_array("@campino@friendica.eu", $tags)); - $this->assertTrue(in_array("@campino@friendica.eu is", $tags));
+ //right now, none of the is matched (unsupported) +// $this->assertFalse(in_array("@Mike@campino@friendica.eu", $tags));
+// $this->assertTrue(in_array("@campino@friendica.eu", $tags)); +// $this->assertTrue(in_array("@campino@friendica.eu is", $tags));
}
/** |