Skip to content

Commit 75e8acf

Browse files
author
Helperhaps
committed
simple test
1 parent 6dc4132 commit 75e8acf

6 files changed

+64
-25
lines changed

Diff for: phpunit.xml.dist

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<phpunit
3+
colors="true"
4+
convertErrorsToExceptions="true"
5+
convertNoticesToExceptions="true"
6+
convertWarningsToExceptions="true"
7+
stopOnFailure="false"
8+
syntaxCheck="true"
9+
bootstrap="tests/bootstrap.php">
10+
<testsuites>
11+
<testsuite name="JPush PHP SDK Test Suite">
12+
<directory>tests/JPush</directory>
13+
</testsuite>
14+
</testsuites>
15+
</phpunit>

Diff for: tests/JPush/DevicePayloadTest.php

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
namespace JPush\Tests;
3+
4+
use JPush\Client;
5+
6+
class DevicePayloadTest extends \PHPUnit_Framework_TestCase {
7+
8+
protected $client;
9+
protected $device;
10+
protected function setUp() {
11+
global $client;
12+
$this->client = $client;
13+
$this->device = $client->device();
14+
}
15+
16+
function testGetDevices() {
17+
global $registration_id;
18+
$device = $this->device->getDevices($registration_id);
19+
echo 'Result=' . json_encode($device);
20+
}
21+
}

Diff for: tests/JPush/PushPayloadTest.php

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
namespace JPush\Tests;
3+
4+
class PushPayloadTest extends \PHPUnit_Framework_TestCase {
5+
6+
protected $client;
7+
protected function setUp() {
8+
global $client;
9+
$this->client = $client;
10+
}
11+
12+
public function testPushToAll() {
13+
$result = $this->client->push()
14+
->setPlatform('all')
15+
->addAllAudience()
16+
->setNotificationAlert('Hi, JPush')
17+
->send();
18+
echo 'Result=' . json_encode($result);
19+
}
20+
}

Diff for: tests/PushPayloadTest.php

-9
This file was deleted.

Diff for: tests/bootstrap.php

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
require_once __DIR__ . '/../vendor/autoload.php';
3+
4+
$app_key = 'xxxx';
5+
$master_secret = 'xxxx';
6+
$client = new JPush\Client($app_key, $master_secret);
7+
8+
$registration_id = 'xxxx';

Diff for: tests/phpunit.xml.dist

-16
This file was deleted.

0 commit comments

Comments
 (0)