Skip to content

Commit

Permalink
add code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
tbarbugli committed Jun 28, 2014
1 parent 146afe6 commit 8149e31
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 22 deletions.
5 changes: 4 additions & 1 deletion .travis.yml
@@ -1,4 +1,7 @@
language: php
php:
- 5.4
before_script: composer install
before_script:
- php composer.phar install --dev --no-interaction
after_script:
- php vendor/bin/coveralls
5 changes: 3 additions & 2 deletions composer.json
Expand Up @@ -12,7 +12,8 @@
}
],
"require-dev": {
"phpunit/phpunit": "3.7.*"
"phpunit/phpunit": "3.7.*",
"satooshi/php-coveralls": "dev-master"
},
"require": {
"php": ">=5.4.0",
Expand All @@ -23,4 +24,4 @@
"GetStream\\Stream" : "lib/"
}
}
}
}
17 changes: 10 additions & 7 deletions phpunit.xml.dist
Expand Up @@ -7,10 +7,13 @@
convertWarningsToExceptions="true"
processIsolation="false"
bootstrap="vendor/autoload.php"
>
<testsuites>
<testsuite name="Test Suite">
<directory>test/</directory>
</testsuite>
</testsuites>
</phpunit>
>
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>
<testsuites>
<testsuite name="Test Suite">
<directory>test/</directory>
</testsuite>
</testsuites>
</phpunit>
29 changes: 17 additions & 12 deletions test/IntegrationFeedTest.php
Expand Up @@ -40,18 +40,22 @@ public function testRemoveActivity() {
$this->assertNotSame($activities[0]['id'], $activity_id);
}

public function testFlatFollow() {
$activity_data = array('actor'=> 1, 'verb'=> 'tweet', 'object'=> 1);
$response = $this->flat3->addActivity($activity_data);
$activity_id = $response['id'];
$this->user1->followFeed('flat:33');
sleep(5);
$activities = $this->user1->getActivities(0, 1)['results'];
$this->assertSame(count($activities), 1);
$this->assertSame($activities[0]['id'], $activity_id);
}

public function testFlatUnfollow() {
// public function testFlatFollow() {
// $activity_data = array('actor'=> 1, 'verb'=> 'tweet', 'object'=> 1);
// $response = $this->flat3->addActivity($activity_data);
// $activity_id = $response['id'];
// $this->user1->unfollowFeed('flat:33');
// sleep(5);
// $this->user1->followFeed('flat:33');
// sleep(5);
// $activities = $this->user1->getActivities(0, 1)['results'];
// $this->assertSame(count($activities), 1);
// $this->assertSame($activities[0]['id'], $activity_id);
// }

public function testFlatFollowUnfollow() {
$this->user1->unfollowFeed('flat:33');
sleep(3);
$activity_data = array('actor'=> 1, 'verb'=> 'tweet', 'object'=> 1);
$response = $this->flat3->addActivity($activity_data);
$activity_id = $response['id'];
Expand All @@ -61,6 +65,7 @@ public function testFlatUnfollow() {
$this->assertSame(count($activities), 1);
$this->assertSame($activities[0]['id'], $activity_id);
$this->user1->unfollowFeed('flat:33');
sleep(5);
$activities = $this->user1->getActivities(0, 1)['results'];
$this->assertNotSame($activities[0]['id'], $activity_id);
}
Expand Down

0 comments on commit 8149e31

Please sign in to comment.