Skip to content

Commit

Permalink
skip GCM tests if the GCM endpoint is not one
Browse files Browse the repository at this point in the history
  • Loading branch information
Minishlink committed Nov 23, 2016
1 parent 07bd808 commit 152de42
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion tests/WebPushTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,21 @@ public function testFlush()

public function testSendGCMNotificationWithoutGCMApiKey()
{
$webPush = new WebPush();
if (substr(self::$endpoints['GCM'], 0, strlen(WebPush::GCM_URL)) !== WebPush::GCM_URL) {
$this->markTestSkipped('The provided GCM URL is not a GCM URL, but probably a FCM URL.');
}

$webPush = new WebPush();
$this->setExpectedException('ErrorException', 'No GCM API Key specified.');
$webPush->sendNotification(self::$endpoints['GCM'], null, null, null, true);
}

public function testSendGCMNotificationWithWrongGCMApiKey()
{
if (substr(self::$endpoints['GCM'], 0, strlen(WebPush::GCM_URL)) !== WebPush::GCM_URL) {
$this->markTestSkipped('The provided GCM URL is not a GCM URL, but probably a FCM URL.');
}

$webPush = new WebPush(array('GCM' => 'bar'));

$res = $webPush->sendNotification(self::$endpoints['GCM'], null, null, null, true);
Expand Down

0 comments on commit 152de42

Please sign in to comment.