tag tests cont.

This commit is contained in:
friendica 2012-04-07 02:11:56 -07:00
parent f30146b521
commit cf2d8ef7a6
2 changed files with 15 additions and 5 deletions

View file

@ -959,7 +959,6 @@ function handle_tag($a, &$body, &$inform, &$str_tags, $profile_uid, $tag) {
else else
$newname = $r[0]['name']; $newname = $r[0]['name'];
//add person's id to $inform //add person's id to $inform
$inform_id = 'cid:' . $r[0]['id'];
if(strlen($inform)) if(strlen($inform))
$inform .= ','; $inform .= ',';
$inform .= 'cid:' . $r[0]['id']; $inform .= 'cid:' . $r[0]['id'];

View file

@ -139,9 +139,19 @@ class GetTagsTest extends PHPUnit_Framework_TestCase {
$str_tags=''; $str_tags='';
handle_tag($this->a, $text, $inform, $str_tags, 11, $tags[0]); handle_tag($this->a, $text, $inform, $str_tags, 11, $tags[0]);
$this->assertEquals("cid:15", $inform); // (mike) - This is a tricky case.
$this->assertEquals("@[url=http://justatest.de]Mike Lastname[/url]", $str_tags); // we support mentions as in @mike@example.com - which contains a period.
$this->assertEquals("hi @[url=http://justatest.de]Mike Lastname[/url].because", $text); // 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);
} }
/** /**
@ -253,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("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("@[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->assertTrue(strstr($inform,"cid:15"));
} }
/** /**