summaryrefslogtreecommitdiff
path: root/plugins/OStatus/tests/remote-tests.php
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2010-03-24 23:33:00 +0100
committerSarven Capadisli <csarven@status.net>2010-03-24 23:33:00 +0100
commit5330e9d861a99dfee9d67160fb125ce2ef86e608 (patch)
tree76041023a4b85c6ae9113fc9726bbe739230ff2b /plugins/OStatus/tests/remote-tests.php
parent97e83112d249cd2fbb281da59c80d43e0fe33818 (diff)
parentecb009bcf5a6893b90d153be18c423dd7377796d (diff)
Merge branch '0.9.x' of git@gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'plugins/OStatus/tests/remote-tests.php')
-rw-r--r--plugins/OStatus/tests/remote-tests.php47
1 files changed, 36 insertions, 11 deletions
diff --git a/plugins/OStatus/tests/remote-tests.php b/plugins/OStatus/tests/remote-tests.php
index b06411491..24b4b1660 100644
--- a/plugins/OStatus/tests/remote-tests.php
+++ b/plugins/OStatus/tests/remote-tests.php
@@ -75,11 +75,16 @@ class OStatusTester extends TestBase
{
$this->setup();
- $this->testLocalPost();
- $this->testMentionUrl();
- $this->testSubscribe();
- $this->testUnsubscribe();
+ $methods = get_class_methods($this);
+ foreach ($methods as $method) {
+ if (strtolower(substr($method, 0, 4)) == 'test') {
+ print "\n";
+ print "== $method ==\n";
+ call_user_func(array($this, $method));
+ }
+ }
+ print "\n";
$this->log("DONE!");
}
@@ -126,6 +131,26 @@ class OStatusTester extends TestBase
$this->assertTrue($this->pub->hasSubscriber($this->sub->getProfileUri()));
}
+ function testPush()
+ {
+ $this->assertTrue($this->sub->hasSubscription($this->pub->getProfileUri()));
+ $this->assertTrue($this->pub->hasSubscriber($this->sub->getProfileUri()));
+
+ $name = $this->sub->username;
+ $post = $this->pub->post("Regular post, which $name should get via PuSH");
+ $this->sub->assertReceived($post);
+ }
+
+ function testMentionSubscribee()
+ {
+ $this->assertTrue($this->sub->hasSubscription($this->pub->getProfileUri()));
+ $this->assertFalse($this->pub->hasSubscription($this->sub->getProfileUri()));
+
+ $name = $this->pub->username;
+ $post = $this->sub->post("Just a quick note back to my remote subscribee @$name");
+ $this->pub->assertReceived($post);
+ }
+
function testUnsubscribe()
{
$this->assertTrue($this->sub->hasSubscription($this->pub->getProfileUri()));
@@ -350,6 +375,7 @@ class SNTestClient extends TestBase
$this->assertEqual($this->fullname, $data['name']);
$this->assertEqual($this->homepage, $data['url']);
$this->assertEqual($this->bio, $data['description']);
+ $this->log(" looks good!");
}
/**
@@ -386,11 +412,11 @@ class SNTestClient extends TestBase
}
$tries--;
if ($tries) {
- $this->log("Didn't see it yet, waiting $timeout seconds");
+ $this->log(" didn't see it yet, waiting $timeout seconds");
sleep($timeout);
}
}
- throw new Exception("Message $notice_uri not received by $this->username");
+ throw new Exception(" message $notice_uri not received by $this->username");
}
/**
@@ -420,10 +446,9 @@ class SNTestClient extends TestBase
}
foreach ($entries as $entry) {
if ($entry->id == $notice_uri) {
- $this->log("found it $notice_uri");
+ $this->log(" found it $notice_uri");
return true;
}
- //$this->log("nope... " . $entry->id);
}
return false;
}
@@ -493,15 +518,15 @@ class SNTestClient extends TestBase
foreach ($follows as $follow) {
$target = $follow->getAttributeNS($ns_rdf, 'resource');
if ($target == ($subscribed . '#acct')) {
- $this->log("Confirmed $subscriber subscribed to $subscribed");
+ $this->log(" confirmed $subscriber subscribed to $subscribed");
return true;
}
}
- $this->log("We found $subscriber but they don't follow $subscribed");
+ $this->log(" we found $subscriber but they don't follow $subscribed");
return false;
}
}
- $this->log("Can't find $subscriber in {$this->username}'s social graph.");
+ $this->log(" can't find $subscriber in {$this->username}'s social graph.");
return false;
}